CoriEngine
Loading...
Searching...
No Matches
EntityState.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace Cori {
5 namespace World {
6 namespace Components {
7 namespace Entity {
8 class StateMachine;
9 }
10 }
11
16 public:
17 virtual ~EntityState() = default;
18
24 virtual void OnEnter([[maybe_unused]] Entity& owner, [[maybe_unused]] const std::type_index& lastStateType) {}
25
31 virtual void OnTickUpdate([[maybe_unused]] Entity& owner, [[maybe_unused]] float timestep) {}
32
38 virtual void OnExit([[maybe_unused]] Entity& owner, [[maybe_unused]] const std::type_index& nextStateType) {}
39
40 [[nodiscard]] virtual const char* GetDebugName() const { return "Unnamed State"; }
41
42 // maybe add an onevent func
43 };
44 }
45}
A StateMachine component is used in combination with custom objects derived from EntityState.
An abstract class designed to be used with StateMachine component.
virtual void OnTickUpdate(Entity &owner, float timestep)
Fired every tick when the Entity is in the state. Expect for the very first tick the Entity entered t...
virtual void OnEnter(Entity &owner, const std::type_index &lastStateType)
Fired when then Entity enter the state.
virtual const char * GetDebugName() const
virtual void OnExit(Entity &owner, const std::type_index &nextStateType)
Fired when the Entity exist the state.
virtual ~EntityState()=default
Entities are the essential part of WorldSystem.
Definition Entity.hpp:25
Components designed to be used with entities.
Components that are used with the WorldSystem (ECS).
Anything connected to WorldSystem (ECS) is in this namespace.
Global engine namespace.