GUInity
|
#include <Component.hpp>
Public Member Functions | |
Component () | |
virtual | ~Component () |
virtual void | init () |
virtual void | destroy () |
virtual void | setActive (bool isActive) |
virtual void | awake () |
virtual void | tick (float deltaSecods) |
shared_ptr< Actor > | getActor () |
void | setActor (weak_ptr< Actor > actor) |
virtual shared_ptr< Component > | clone ()=0 |
virtual shared_ptr< ComponentDescription > | getComponentDescription ()=0 |
virtual void | deserialize (shared_ptr< ComponentDescription > desc)=0 |
Protected Member Functions | |
void | setCopyMode (bool initWithData) |
Protected Attributes | |
bool | initWithData |
bool | isActive |
Component is the very basis of the engine. All the actor behaviour should come from a component Component-based game engines allow for small, modular classes that are reused very often. Component behaviour can vary from custom ScriptComponent (custom behaviour) to RigidBody physics and MeshRenderer. A Component can only exist in conjunction with an actor. Component is an abstract class and is the parent of all Components.
Component::Component | ( | ) |
Default Constructor
|
virtual |
Default Destructor. Virtual because is parent class
|
inlinevirtual |
Called by Actor owner when it's first awaken
Reimplemented in Camera, Collider, ScriptComponent, ScaleTool, PlayerScript, MoveTool, RotateHandle, RotateTool, and IncreaseColliderScript.
|
pure virtual |
Pure virtual function. Clones current component (Prototype Design Pattern)
Implemented in Camera, RigidBody, Collider, MeshRenderer, CapsuleCollider, FontMesh, ScriptComponent, EditorCollider, Light, MeshComponent, PlayerScript, RigidStatic, SphereCollider, BoxCollider, MeshFilter, and MeshCollider.
|
inlinevirtual |
Destroys Component and release any component-specific members
Reimplemented in Camera, Collider, MeshRenderer, RigidBody, Light, ScriptComponent, and RigidStatic.
|
inlinevirtual |
Initializes the component. Initialization should not be done in constructor due to enable_shared_from_this<T> inheritance.
Reimplemented in Camera, Collider, CapsuleCollider, MeshRenderer, RigidBody, Light, SphereCollider, EditorCollider, ScriptComponent, RigidStatic, BoxCollider, MeshCollider, and EditorCameraControl.
|
protected |
Used when been deserialized or cloned
[in] | initWithData | true if this component data will come from clone of deserialization, false if it's a new component being creates |
|
inlinevirtual |
Called by actor every frame
[in] | deltaSeconds | - last frame duration |
Reimplemented in Camera, RigidBody, ScriptComponent, EditorCollider, ScaleHandle, RigidStatic, ScaleTool, PlayerScript, MeshCollider, MoveHandle, RotateOverTime, AddForceScript, MoveTool, RotateHandle, EditorCameraControl, RotateTool, and IncreaseColliderScript.
|
protected |
Used when been deserialized or cloned
|
protected |
Is component active