A class representing a script component that can be attached to game objects.
More...
#include <ScriptComponent.hpp>
A class representing a script component that can be attached to game objects.
This class extends the Component
class and provides functionality for handling scripts, including adding script variables and managing script files.
◆ addFloatVariable()
void shkyera::ScriptComponent::addFloatVariable |
( |
std::string |
name | ) |
|
Add a public float variable to the script component.
- Parameters
-
name | The name of the float variable to add. |
◆ addIntVariable()
void shkyera::ScriptComponent::addIntVariable |
( |
std::string |
name | ) |
|
Add a public integer variable to the script component.
- Parameters
-
name | The name of the integer variable to add. |
◆ addScript() [1/2]
Add a script component to a game object and attach a script file.
- Parameters
-
object | A shared pointer to the game object. |
file | A shared pointer to the script file. |
- Returns
- A shared pointer to the created script component.
◆ addScript() [2/2]
void shkyera::ScriptComponent::addScript |
( |
std::shared_ptr< ScriptComponent > |
script | ) |
|
|
static |
Add an existing script component to the list of managed scripts.
- Parameters
-
script | A shared pointer to the script component to add. |
◆ addStringVariable()
void shkyera::ScriptComponent::addStringVariable |
( |
std::string |
name | ) |
|
Add a public string variable to the script component.
- Parameters
-
name | The name of the string variable to add. |
◆ addVec3Variable()
void shkyera::ScriptComponent::addVec3Variable |
( |
std::string |
name | ) |
|
Add a public glm::vec3 variable to the script component.
- Parameters
-
name | The name of the glm::vec3 variable to add. |
◆ Component()
shkyera::Component::Component |
Constructor to initialize a component with a shared pointer to a game object.
- Parameters
-
object | A shared pointer to the game object to which this component is attached. |
◆ getFile()
const std::shared_ptr< File > shkyera::ScriptComponent::getFile |
( |
| ) |
const |
Get the script file associated with this script component.
- Returns
- A shared pointer to the script file.
◆ getFloatVariables()
std::vector< PublicFloat > & shkyera::ScriptComponent::getFloatVariables |
( |
| ) |
|
Get a reference to the vector of public float variables.
- Returns
- A reference to the vector of public float variables.
◆ getIntVariables()
std::vector< PublicInt > & shkyera::ScriptComponent::getIntVariables |
( |
| ) |
|
Get a reference to the vector of public integer variables.
- Returns
- A reference to the vector of public integer variables.
◆ getScripts()
std::vector< std::shared_ptr< ScriptComponent > > shkyera::ScriptComponent::getScripts |
( |
| ) |
|
|
static |
Get a list of all managed script components.
- Returns
- A vector of shared pointers to script components.
◆ getStringVariables()
std::vector< PublicString > & shkyera::ScriptComponent::getStringVariables |
( |
| ) |
|
Get a reference to the vector of public string variables.
- Returns
- A reference to the vector of public string variables.
◆ getVec3Variables()
std::vector< PublicVec3 > & shkyera::ScriptComponent::getVec3Variables |
( |
| ) |
|
Get a reference to the vector of public glm::vec3 variables.
- Returns
- A reference to the vector of public glm::vec3 variables.
◆ moveScript()
void shkyera::ScriptComponent::moveScript |
( |
| ) |
|
Move the script associated with this component.
◆ moveScripts()
void shkyera::ScriptComponent::moveScripts |
( |
| ) |
|
|
static |
Move all scripts to their respective destinations.
◆ removeScript()
void shkyera::ScriptComponent::removeScript |
( |
std::shared_ptr< ScriptComponent > |
script | ) |
|
|
static |
Remove a script component from the list of managed scripts.
- Parameters
-
script | A shared pointer to the script component to remove. |
◆ setFile()
void shkyera::ScriptComponent::setFile |
( |
std::shared_ptr< File > |
file | ) |
|
Set the script file associated with this script component.
- Parameters
-
file | A shared pointer to the script file. |
◆ update()
void shkyera::ScriptComponent::update |
( |
| ) |
|
Update the script component.
TODO: Implement more types
◆ verifyScripts()
void shkyera::ScriptComponent::verifyScripts |
( |
| ) |
|
|
staticprivate |
Verify the existence of script files and components.
◆ _file
std::shared_ptr<File> shkyera::ScriptComponent::_file |
|
private |
The associated script file.
◆ _floatVariables
std::vector<PublicFloat> shkyera::ScriptComponent::_floatVariables |
|
private |
List of public float variables.
◆ _intVariables
std::vector<PublicInt> shkyera::ScriptComponent::_intVariables |
|
private |
List of public integer variables.
◆ _scripts
std::vector< std::shared_ptr< ScriptComponent > > shkyera::ScriptComponent::_scripts = {} |
|
staticprivate |
List of managed script components.
◆ _stringVariables
std::vector<PublicString> shkyera::ScriptComponent::_stringVariables |
|
private |
List of public string variables.
◆ _vec3Variables
std::vector<PublicVec3> shkyera::ScriptComponent::_vec3Variables |
|
private |
List of public glm::vec3 variables.
◆ SCRIPT_DESTINATION
std::string shkyera::ScriptComponent::SCRIPT_DESTINATION = "src/python/shkyera" |
|
inlinestatic |
The destination directory for scripts (static member).
The documentation for this class was generated from the following files: