GUInity
|
#include <Actor.hpp>
Public Member Functions | |
Actor () | |
Actor (string name) | |
Actor (Actor &&)=delete | |
virtual | ~Actor () |
shared_ptr< Actor > | clone () |
void | awake () |
void | tick (float deltaSeconds) |
void | triggerPhysxCollision (Actor *actor) |
void | triggerPhysxTrigger (Actor *actor) |
shared_ptr< Actor > | getParent () |
void | setParent (shared_ptr< Actor > parent) |
void | addChildren (shared_ptr< Actor > children) |
void | setActive (bool isActive) |
bool | getIsActive () |
void | setEditorFlag (bool isEditor) |
bool | getEditorFlag () |
void | initComponents () |
void | addComponent (shared_ptr< Component > component) |
void | destroyComponents () |
template<typename T > | |
shared_ptr< T > | AddComponent () |
template<typename T > | |
shared_ptr< T > | GetComponent () |
Public Attributes | |
string | name |
shared_ptr< Transform > | transform |
vector< shared_ptr< Component > > | components |
weak_ptr< Actor > | parent |
vector< weak_ptr< Actor > > | children |
Actor is the base Game Object. Since GUInity is a component-based engine, the idea is NOT to inherit from Actor to create new behaviours. On the contrary, every game object in the world should be an Actor and their behaviour should come from different components.
|
inline |
Default Constructor
Actor::Actor | ( | string | name | ) |
Constructor with actor name
|
delete |
Prevent move constructor
|
virtual |
Default Destructor
void Actor::addChildren | ( | shared_ptr< Actor > | children | ) |
Add children to list
void Actor::addComponent | ( | shared_ptr< Component > | component | ) |
addComponent. Attaches an existing component to the actor. This function is used for deserialization of Actors
|
inline |
Generic AddComponent. This function creates a smart pointer to the desired component and returns it
void Actor::awake | ( | ) |
Awake. This function is called to Awake all the components attached to the actor
|
inline |
Generic GetComponent. This function looks for a component of the desired type from the components list and returns the first it finds
bool Actor::getEditorFlag | ( | ) |
editorFlat getter
editorFlag setter
bool Actor::getIsActive | ( | ) |
isActive getter
shared_ptr< Actor > Actor::getParent | ( | ) |
Parent getter
void Actor::initComponents | ( | ) |
initComponents. This function is called to Initialize all the components attached to the actor
void Actor::setActive | ( | bool | isActive | ) |
isActive setter
void Actor::setEditorFlag | ( | bool | isEditor | ) |
editorFlat setter
editorFlag setter
void Actor::setParent | ( | shared_ptr< Actor > | parent | ) |
Parent setter
void Actor::tick | ( | float | deltaSeconds | ) |
Tick. Function called every frame. This function is responsible for calling the Tick for each Component attached to the actor
void Actor::triggerPhysxCollision | ( | Actor * | actor | ) |
Function that receives Collision from PhysX - Other actor that collided with this
Function that receives Collision from PhysX - Other actor that collided with this
Delegates the collision to all ScriptComponents. Trying to emulate Unity, where every script can contain code to handle Collision
void Actor::triggerPhysxTrigger | ( | Actor * | actor | ) |
Function that receives Trigger Collision from PhysX - Other actor that collided with this
Function that receives Trigger Collision from PhysX - Other actor that collided with this
Delegates the collision to all ScriptComponents. Trying to emulate Unity, where every script can contain code to handle Collision
vector<weak_ptr<Actor> > Actor::children |
Children. All the Actors that are children of this. Weak_ptr because we don't want this object to prevent an Actor to be destroyed
vector<shared_ptr<Component> > Actor::components |
string Actor::name |
Name of the Actor
weak_ptr<Actor> Actor::parent |
Parent. Actors can have parent to create hierarchy. Hierarchy is important to group several Actors into one Weak_ptr because we don't want this object to prevent an Actor to be destroyed
shared_ptr<Transform> Actor::transform |