Class Entity
- Namespace
- WitShells.DesignPatterns.Core
Represents a game object in the Entity-Component-System (ECS) pattern. An entity is nothing more than a container of Component instances — it has no logic itself. Behaviour is provided by systems that query entities for required components.
public class Entity
- Inheritance
-
Entity
- Inherited Members
Methods
AddComponent<T>(T)
Adds (or replaces) a component of type T on this entity.
public void AddComponent<T>(T component) where T : Component
Parameters
componentTThe component data to attach.
Type Parameters
TThe component type.
GetComponent<T>()
Returns the component of type T attached to this entity,
or null if not present.
public T GetComponent<T>() where T : Component
Returns
- T
Type Parameters
TThe component type to retrieve.
HasComponent<T>()
Returns true if this entity has a component of type T.
public bool HasComponent<T>() where T : Component
Returns
Type Parameters
T