Overload  1.1
Game engine with editor
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
OvCore::ECS::Components::Behaviour Class Reference

#include <Behaviour.h>

Inheritance diagram for OvCore::ECS::Components::Behaviour:
OvCore::ECS::Components::AComponent OvCore::API::IInspectorItem OvCore::API::ISerializable

Public Member Functions

 Behaviour (ECS::Actor &p_owner, const std::string &p_name)
 
 ~Behaviour ()
 
virtual std::string GetName () override
 
bool RegisterToLuaContext (sol::state &p_luaState, const std::string &p_scriptFolder)
 
void UnregisterFromLuaContext ()
 
template<typename... Args>
void LuaCall (const std::string &p_functionName, Args &&... p_args)
 
sol::table & GetTable ()
 
virtual void OnAwake () override
 
virtual void OnStart () override
 
virtual void OnEnable () override
 
virtual void OnDisable () override
 
virtual void OnDestroy () override
 
virtual void OnUpdate (float p_deltaTime) override
 
virtual void OnFixedUpdate (float p_deltaTime) override
 
virtual void OnLateUpdate (float p_deltaTime) override
 
virtual void OnCollisionEnter (Components::CPhysicalObject &p_otherObject) override
 
virtual void OnCollisionStay (Components::CPhysicalObject &p_otherObject) override
 
virtual void OnCollisionExit (Components::CPhysicalObject &p_otherObject) override
 
virtual void OnTriggerEnter (Components::CPhysicalObject &p_otherObject) override
 
virtual void OnTriggerStay (Components::CPhysicalObject &p_otherObject) override
 
virtual void OnTriggerExit (Components::CPhysicalObject &p_otherObject) override
 
virtual void OnSerialize (tinyxml2::XMLDocument &p_doc, tinyxml2::XMLNode *p_node) override
 
virtual void OnDeserialize (tinyxml2::XMLDocument &p_doc, tinyxml2::XMLNode *p_node) override
 
virtual void OnInspector (OvUI::Internal::WidgetContainer &p_root) override
 
- Public Member Functions inherited from OvCore::ECS::Components::AComponent
 AComponent (ECS::Actor &p_owner)
 
virtual ~AComponent ()
 

Public Attributes

const std::string name
 
- Public Attributes inherited from OvCore::ECS::Components::AComponent
ECS::Actorowner
 

Static Public Attributes

static OvTools::Eventing::Event< Behaviour * > CreatedEvent
 
static OvTools::Eventing::Event< Behaviour * > DestroyedEvent
 

Detailed Description

ABehaviour is the base class for any behaviour. A Behaviour is a script that is used to manipulate an actor over time

Constructor & Destructor Documentation

◆ Behaviour()

OvCore::ECS::Components::Behaviour::Behaviour ( ECS::Actor p_owner,
const std::string &  p_name 
)

Constructor of a ABehaviour (Must be called by derived classes)

Parameters
p_owner

◆ ~Behaviour()

OvCore::ECS::Components::Behaviour::~Behaviour ( )

Destructor

Member Function Documentation

◆ GetName()

std::string OvCore::ECS::Components::Behaviour::GetName ( )
overridevirtual

Returns the name of the component

Implements OvCore::ECS::Components::AComponent.

◆ GetTable()

sol::table & OvCore::ECS::Components::Behaviour::GetTable ( )

Return the lua table attached to this behaviour

◆ LuaCall()

template<typename ... Args>
void OvCore::ECS::Components::Behaviour::LuaCall ( const std::string &  p_functionName,
Args &&...  p_args 
)
inline

Call a lua function for this behaviour

Parameters
p_functionName
p_args

◆ OnAwake()

void OvCore::ECS::Components::Behaviour::OnAwake ( )
overridevirtual

Called when the scene start right before OnStart It allows you to apply prioritized game logic on scene start

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnCollisionEnter()

void OvCore::ECS::Components::Behaviour::OnCollisionEnter ( Components::CPhysicalObject p_otherObject)
overridevirtual

Called when the owner of this component enter in collision with another physical object

Parameters
p_otherObject

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnCollisionExit()

void OvCore::ECS::Components::Behaviour::OnCollisionExit ( Components::CPhysicalObject p_otherObject)
overridevirtual

Called when the owner of this component exit from collision with another physical object

Parameters
p_otherObject

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnCollisionStay()

void OvCore::ECS::Components::Behaviour::OnCollisionStay ( Components::CPhysicalObject p_otherObject)
overridevirtual

Called when the owner of this component is in collision with another physical object

Parameters
p_otherObject

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnDeserialize()

void OvCore::ECS::Components::Behaviour::OnDeserialize ( tinyxml2::XMLDocument &  p_doc,
tinyxml2::XMLNode *  p_node 
)
overridevirtual

Deserialize the behaviour

Parameters
p_doc
p_node

Implements OvCore::API::ISerializable.

◆ OnDestroy()

void OvCore::ECS::Components::Behaviour::OnDestroy ( )
overridevirtual

Called when the behaviour gets destroyed

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnDisable()

void OvCore::ECS::Components::Behaviour::OnDisable ( )
overridevirtual

Called when the behaviour gets disabled (owner SetActive set to false)

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnEnable()

void OvCore::ECS::Components::Behaviour::OnEnable ( )
overridevirtual

Called when the behaviour gets enabled (owner SetActive set to true)

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnFixedUpdate()

void OvCore::ECS::Components::Behaviour::OnFixedUpdate ( float  p_deltaTime)
overridevirtual

Called every physics frame

Parameters
p_deltaTime

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnInspector()

void OvCore::ECS::Components::Behaviour::OnInspector ( OvUI::Internal::WidgetContainer p_root)
overridevirtual

Defines how the behaviour should be drawn in the inspector

Parameters
p_root

Implements OvCore::API::IInspectorItem.

◆ OnLateUpdate()

void OvCore::ECS::Components::Behaviour::OnLateUpdate ( float  p_deltaTime)
overridevirtual

Called every frame after OnUpdate

Parameters
p_deltaTime

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnSerialize()

void OvCore::ECS::Components::Behaviour::OnSerialize ( tinyxml2::XMLDocument &  p_doc,
tinyxml2::XMLNode *  p_node 
)
overridevirtual

Serialize the behaviour

Parameters
p_doc
p_node

Implements OvCore::API::ISerializable.

◆ OnStart()

void OvCore::ECS::Components::Behaviour::OnStart ( )
overridevirtual

Called when the scene start right after OnAwake It allows you to apply prioritized game logic on scene start

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnTriggerEnter()

void OvCore::ECS::Components::Behaviour::OnTriggerEnter ( Components::CPhysicalObject p_otherObject)
overridevirtual

Called when the owner of this component enter in trigger with another physical object

Parameters
p_otherObject

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnTriggerExit()

void OvCore::ECS::Components::Behaviour::OnTriggerExit ( Components::CPhysicalObject p_otherObject)
overridevirtual

Called when the owner of this component exit from trigger with another physical object

Parameters
p_otherObject

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnTriggerStay()

void OvCore::ECS::Components::Behaviour::OnTriggerStay ( Components::CPhysicalObject p_otherObject)
overridevirtual

Called when the owner of this component is in trigger with another physical object

Parameters
p_otherObject

Reimplemented from OvCore::ECS::Components::AComponent.

◆ OnUpdate()

void OvCore::ECS::Components::Behaviour::OnUpdate ( float  p_deltaTime)
overridevirtual

Called every frame

Parameters
p_deltaTime

Reimplemented from OvCore::ECS::Components::AComponent.

◆ RegisterToLuaContext()

bool OvCore::ECS::Components::Behaviour::RegisterToLuaContext ( sol::state &  p_luaState,
const std::string &  p_scriptFolder 
)

Register the behaviour to lua Returns true on success

Parameters
p_luaState
p_rootFolder

◆ UnregisterFromLuaContext()

void OvCore::ECS::Components::Behaviour::UnregisterFromLuaContext ( )

Register the behaviour to lua Returns true on success

Member Data Documentation

◆ CreatedEvent

OvTools::Eventing::Event< OvCore::ECS::Components::Behaviour * > OvCore::ECS::Components::Behaviour::CreatedEvent
static

@project: Overload

Author
: Overload Tech. @restrictions: This software may not be resold, redistributed or otherwise conveyed to a third party.

◆ DestroyedEvent

OvTools::Eventing::Event< OvCore::ECS::Components::Behaviour * > OvCore::ECS::Components::Behaviour::DestroyedEvent
static

◆ name

const std::string OvCore::ECS::Components::Behaviour::name

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