My Project
Loading...
Searching...
No Matches
UserScript Class Reference

Represents a user-defined script that can be attached to game objects. More...

#include <UserScript.hpp>

Inheritance diagram for UserScript:
Script

Public Member Functions

 UserScript (std::string ScriptName)
 Constructs a new UserScript with the given name.
 ~UserScript ()=default
 Default destructor.
void OnStart () override
 Called once when the script starts. Override this to initialize state or references needed by the script.
void Update (float deltatime) override
 Called every frame to update the script logic.
void SetName (const std::string &newName)
 Sets the name of the script.
const std::string & GetName () const
 Gets the name of the script.
Public Member Functions inherited from Script
virtual ~Script ()=default
 Virtual destructor. Ensures derived scripts are properly destroyed when deleted via a base pointer.

Protected Attributes

std::string name
 The name of the script.

Detailed Description

Represents a user-defined script that can be attached to game objects.

Inherits from the abstract base class Script. Provides a name and implements the OnStart and Update lifecycle methods, which are called by the ScriptManager.

Constructor & Destructor Documentation

◆ UserScript()

UserScript::UserScript ( std::string ScriptName)

Constructs a new UserScript with the given name.

Parameters
ScriptNameThe name to assign to this script.

◆ ~UserScript()

UserScript::~UserScript ( )
default

Default destructor.

Member Function Documentation

◆ GetName()

const std::string & UserScript::GetName ( ) const
inline

Gets the name of the script.

Returns
const std::string& The current name of the script.

◆ OnStart()

void UserScript::OnStart ( )
overridevirtual

Called once when the script starts. Override this to initialize state or references needed by the script.

Implements Script.

◆ SetName()

void UserScript::SetName ( const std::string & newName)
inline

Sets the name of the script.

Parameters
newNameNew name to assign.

◆ Update()

void UserScript::Update ( float deltatime)
overridevirtual

Called every frame to update the script logic.

Parameters
deltatimeTime elapsed since the last frame, in seconds.

Implements Script.

Member Data Documentation

◆ name

std::string UserScript::name
protected

The name of the script.


The documentation for this class was generated from the following file: