Base system class. More...
#include <ecsm.hpp>
Public Member Functions | |
virtual const std::string & | getComponentName () const |
Returns specific component name of the system. | |
virtual std::type_index | getComponentType () const |
Returns specific component typeid() of the system. | |
virtual View< Component > | getComponent (ID< Component > instance) |
Returns specific system component View. | |
virtual void | disposeComponents () |
Actually destroys system components. | |
Protected Member Functions | |
virtual | ~System ()=default |
Destroys system instance. | |
virtual ID< Component > | createComponent (ID< Entity > entity) |
Creates a new system component instance for the entity. | |
virtual void | destroyComponent (ID< Component > instance) |
Destroys system component instance. | |
virtual void | copyComponent (View< Component > source, View< Component > destination) |
Copies system component data from source to destination. | |
Friends | |
class | Entity |
class | Manager |
class | SystemExt |
Base system class.
Systems are responsible for updating and processing entities with specific components. Each system typically focuses on a particular aspect of the game or simulation. Systems iterate over entities that have the necessary components and perform the required actions or calculations.
|
protectedvirtualdefault |
Destroys system instance.
Creates a new system component instance for the entity.
You should use Manager to add components to the entity.
entity | target entity instance |
Reimplemented in ComponentSystem< T, DestroyComponents >, ComponentSystem< DoNotDestroyComponent, false >, and ComponentSystem< DoNotDuplicateComponent, false >.
Destroys system component instance.
You should use Manager to remove components from the entity.
instance | target component instance |
Reimplemented in ComponentSystem< T, DestroyComponents >, ComponentSystem< DoNotDestroyComponent, false >, and ComponentSystem< DoNotDuplicateComponent, false >.
|
protectedvirtual |
Copies system component data from source to destination.
You should use Manager to copy component data of entities.
source | source component view (from) |
destination | destination component view (to) |
Reimplemented in ComponentSystem< T, DestroyComponents >, ComponentSystem< DoNotDestroyComponent, false >, and ComponentSystem< DoNotDuplicateComponent, false >.
|
virtual |
Returns specific component name of the system.
Reimplemented in ComponentSystem< T, DestroyComponents >, ComponentSystem< DoNotDestroyComponent, false >, ComponentSystem< DoNotDuplicateComponent, false >, DoNotDestroySystem, and DoNotDuplicateSystem.
|
virtual |
Returns specific component typeid() of the system.
Reimplemented in ComponentSystem< T, DestroyComponents >, ComponentSystem< DoNotDestroyComponent, false >, and ComponentSystem< DoNotDuplicateComponent, false >.
Returns specific system component View.
instance | target component instance |
Reimplemented in ComponentSystem< T, DestroyComponents >, ComponentSystem< DoNotDestroyComponent, false >, and ComponentSystem< DoNotDuplicateComponent, false >.
|
virtual |
Actually destroys system components.
Components are not destroyed immediately, only after the dispose call.
Reimplemented in ComponentSystem< T, DestroyComponents >, ComponentSystem< DoNotDestroyComponent, false >, and ComponentSystem< DoNotDuplicateComponent, false >.