HatchitGame
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Hatchit::Game::Component Class Referenceabstract
Inheritance diagram for Hatchit::Game::Component:
Hatchit::Game::AudioListener Hatchit::Game::AudioSource Hatchit::Game::Camera Hatchit::Game::LightComponent Hatchit::Game::MeshRenderer Hatchit::Game::TestComponent Hatchit::Game::TweenComponent Hatchit::Game::TweenPosition Hatchit::Game::TweenRotation Hatchit::Game::TweenScale

Public Member Functions

 Component (const Component &rhs)=default
 
 Component (Component &&rhs)=default
 
Componentoperator= (const Component &rhs)=default
 
Componentoperator= (Component &&rhs)=default
 
virtual Core::JSON VSerialize (void)=0
 
virtual bool VDeserialize (const Core::JSON &jsonObject)=0
 
GameObjectGetOwner (void)
 Getter which returns the GameObject to which this Component is attached. More...
 
bool GetEnabled (void)
 Getter that returns that value of m_enabled. More...
 
void SetEnabled (bool value)
 Setter that sets the value of m_enabled. More...
 
virtual void VOnInit (void)=0
 Called when the GameObject is created to initialize all values.
 
virtual void VOnUpdate (void)=0
 Called once per frame while the GameObject is enabled. More...
 
virtual void VOnDestroy (void)=0
 Called when the GameObject is destroyed/deleted. More...
 
virtual ComponentVClone (void) const =0
 Creates a copy of this Component. More...
 
virtual Core::Guid VGetComponentId (void) const =0
 
void SetOwner (GameObject *owner)
 Setter that sets which GameObject this Component is attached to. More...
 

Static Public Member Functions

template<typename T >
static Core::Guid GetComponentId (void)
 Returns the unique id associated with a Component of type T. More...
 

Protected Member Functions

virtual void VOnEnabled (void)=0
 Called when the Component is enabled. More...
 
virtual void VOnDisabled (void)=0
 Called when the Component is disabled. More...
 

Protected Attributes

bool m_enabled {true}
 bool indicating if this Component is enabled. More...
 
GameObjectm_owner
 The GameObject to which this Component is attached. More...
 

Member Function Documentation

template<typename T >
Core::Guid Component::GetComponentId ( void  )
static

Returns the unique id associated with a Component of type T.

Template Parameters
TA sub-class of Component.
Returns
A Guid which is this Component's unique ID.

< This value is set once when the template is instantiated.

bool Component::GetEnabled ( void  )

Getter that returns that value of m_enabled.

Returns
true if this Component is enabled.
GameObject * Component::GetOwner ( void  )

Getter which returns the GameObject to which this Component is attached.

Returns
Pointer to the GameObject.
void Component::SetEnabled ( bool  value)

Setter that sets the value of m_enabled.

Parameters
valueThe new value of m_enabled.
void Component::SetOwner ( GameObject owner)

Setter that sets which GameObject this Component is attached to.

Parameters
ownerThe GameObject to which this Component is attached.
virtual Component* Hatchit::Game::Component::VClone ( void  ) const
pure virtual
virtual void Hatchit::Game::Component::VOnDestroy ( void  )
pure virtual

Called when the GameObject is destroyed/deleted.

Objects are always disabled before destroyed. When a scene is destroyed, all gameobjects are disabled before any are destroyed.

Implemented in Hatchit::Game::TweenComponent, Hatchit::Game::MeshRenderer, Hatchit::Game::AudioSource, Hatchit::Game::LightComponent, Hatchit::Game::Camera, Hatchit::Game::TestComponent, and Hatchit::Game::AudioListener.

virtual void Hatchit::Game::Component::VOnDisabled ( void  )
protectedpure virtual

Called when the Component is disabled.

Components are always disabled before destroyed. When a scene is destroyed, all Components are disabled before any are destroyed.

Implemented in Hatchit::Game::TweenComponent, Hatchit::Game::Camera, Hatchit::Game::MeshRenderer, Hatchit::Game::AudioSource, Hatchit::Game::LightComponent, Hatchit::Game::AudioListener, and Hatchit::Game::TestComponent.

virtual void Hatchit::Game::Component::VOnEnabled ( void  )
protectedpure virtual

Called when the Component is enabled.

This happens when a scene has finished loading, or immediately after creation if the scene is already loaded.

Implemented in Hatchit::Game::TweenComponent, Hatchit::Game::AudioSource, Hatchit::Game::Camera, Hatchit::Game::MeshRenderer, Hatchit::Game::LightComponent, Hatchit::Game::AudioListener, and Hatchit::Game::TestComponent.

virtual void Hatchit::Game::Component::VOnUpdate ( void  )
pure virtual

Member Data Documentation

bool Hatchit::Game::Component::m_enabled {true}
protected

bool indicating if this Component is enabled.

GameObject* Hatchit::Game::Component::m_owner
protected

The GameObject to which this Component is attached.


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