GUInity
Public Member Functions | Public Attributes | List of all members
Actor Class Reference

#include <Actor.hpp>

Inheritance diagram for Actor:

Public Member Functions

 Actor ()
 
 Actor (string name)
 
 Actor (Actor &&)=delete
 
virtual ~Actor ()
 
shared_ptr< Actorclone ()
 
void awake ()
 
void tick (float deltaSeconds)
 
void triggerPhysxCollision (Actor *actor)
 
void triggerPhysxTrigger (Actor *actor)
 
shared_ptr< ActorgetParent ()
 
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< Transformtransform
 
vector< shared_ptr< Component > > components
 
weak_ptr< Actorparent
 
vector< weak_ptr< Actor > > children
 

Detailed Description

Actor

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.

Constructor & Destructor Documentation

Actor::Actor ( )
inline

Default Constructor

Actor::Actor ( string  name)

Constructor with actor name

Actor::Actor ( Actor &&  )
delete

Prevent move constructor

Actor::~Actor ( )
virtual

Default Destructor

Member Function Documentation

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

template<typename T >
shared_ptr<T> Actor::AddComponent ( )
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

template<typename T >
shared_ptr<T> Actor::GetComponent ( )
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

Member Data Documentation

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

The components of the Actor, may vary from Collider to Script

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

Transform of the Actor. By default every Actor has a transform. For further improvements, it could be considered to treat Transform as any other component


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