Represents an entity in the game world.
More...
|
class | EntityCreator |
| Class responsible for creating entities and configuring their properties. More...
|
|
|
| Entity () |
| Initializes a new instance of the Entity class.
|
|
| Entity (float x, float y) |
| Initializes a new instance of the Entity class.
|
|
| Entity (Vector2 startPos) |
| Initializes a new instance of the Entity class.
|
|
virtual void | Update (float deltaTime) |
| Updates the entity.
|
|
T | AddComponent< T > () |
| Adds a new component of type T to the entity.
|
|
T | AddComponent< T > (T comp) |
| Adds a specific component instance to the entity.
|
|
T | GetComponent< T > () |
| Gets the component of type T attached to the entity.
|
|
void | RemoveComponent< T > () |
| Removes the component of the specified type from the entity.
|
|
void | RemoveComponent (Type componentType) |
| Removes the component of the specified type from the entity.
|
|
void | InternalUpdate (float deltaTime) |
| Performs internal updates on all components attached to the entity.
|
|
bool | HasComponentOfType (Type componentType) |
| Checks if the entity has a component of the specified type attached.
|
|
bool | HasComponentOfType< T > () |
| Checks if the entity has a component of the specified type attached.
|
|
Component[] | GetComponents () |
| Gets an array of all components attached to the entity.
|
|
bool | HasComponent< T > () |
| Checks if the entity has a component of the specified type attached.
|
|
|
Transform | transform |
| The transform component of the entity.
|
|
readonly string | ID |
| Unique identifier for the entity.
|
|
string | tag = "" |
| The tag of the entity.
|
|
string | Name |
| The name of the entity.
|
|
|
bool | Enabled [get, set] |
| Gets or sets a value indicating whether the entity is enabled.
|
|
|
HashSet< Component > | components |
| List of components attached to the entity.
|
|
readonly object | componentsLock = new() |
| Lock object for synchronizing access to the components list.
|
|
bool | enabled = true |
| Indicates whether the entity is enabled.
|
|
|
static List< Entity > | entities = new() |
| List of all entities in the game.
|
|
Represents an entity in the game world.
◆ Entity() [1/3]
WoopWoop.Entity.Entity |
( |
| ) |
|
Initializes a new instance of the Entity class.
◆ Entity() [2/3]
WoopWoop.Entity.Entity |
( |
float | x, |
|
|
float | y ) |
Initializes a new instance of the Entity class.
- Parameters
-
x | The initial x-coordinate of the entity. |
y | The initial y-coordinate of the entity. |
◆ Entity() [3/3]
WoopWoop.Entity.Entity |
( |
Vector2 | startPos | ) |
|
Initializes a new instance of the Entity class.
- Parameters
-
startPos | The initial position of the entity. |
◆ AddComponent< T >() [1/2]
T WoopWoop.Entity.AddComponent< T > |
( |
| ) |
|
Adds a new component of type T to the entity.
- Template Parameters
-
T | The type of component to add. |
- Returns
- The added component.
◆ AddComponent< T >() [2/2]
T WoopWoop.Entity.AddComponent< T > |
( |
T | comp | ) |
|
Adds a specific component instance to the entity.
- Template Parameters
-
T | The type of the component to add. |
- Parameters
-
comp | The instance of the component to add. |
- Returns
- The added component.
◆ CreateEntity()
Creates a new entity creator.
- Returns
- A new instance of the EntityCreator class.
◆ Destroy()
static void WoopWoop.Entity.Destroy |
( |
Entity | entity | ) |
|
|
static |
Destroys an entity, removing it from the list of entities and stopping its components.
- Parameters
-
entity | The entity to destroy. |
◆ GetAllEntities()
static Entity[] WoopWoop.Entity.GetAllEntities |
( |
| ) |
|
|
static |
Retrieves an array containing all entities in the game.
- Returns
- An array containing all entities.
◆ GetComponent< T >()
T WoopWoop.Entity.GetComponent< T > |
( |
| ) |
|
Gets the component of type T attached to the entity.
- Template Parameters
-
T | The type of component to get. |
- Returns
- The component of type T, or null if not found.
◆ GetComponents()
Component[] WoopWoop.Entity.GetComponents |
( |
| ) |
|
Gets an array of all components attached to the entity.
- Returns
- An array of components.
◆ GetEntitiesWithTag()
static Entity[] WoopWoop.Entity.GetEntitiesWithTag |
( |
string | tag | ) |
|
|
static |
Retrieves all entities with the specified tag.
- Parameters
-
tag | The tag to search for. |
- Returns
- An array containing all entities with the specified tag.
◆ GetEntityWithUUID()
static Entity WoopWoop.Entity.GetEntityWithUUID |
( |
string | uuid | ) |
|
|
static |
Retrieves an entity with the specified UUID.
- Parameters
-
uuid | The UUID of the entity to retrieve. |
- Returns
- The entity with the specified UUID, or null if not found.
◆ HasComponent< T >()
bool WoopWoop.Entity.HasComponent< T > |
( |
| ) |
|
Checks if the entity has a component of the specified type attached.
- Template Parameters
-
T | The type of component to check for. |
- Returns
- True if the entity has a component of the specified type, otherwise false.
◆ HasComponentOfType()
bool WoopWoop.Entity.HasComponentOfType |
( |
Type | componentType | ) |
|
Checks if the entity has a component of the specified type attached.
- Parameters
-
componentType | The type of component to check for. |
- Returns
- True if the entity has a component of the specified type, otherwise false.
◆ HasComponentOfType< T >()
Checks if the entity has a component of the specified type attached.
- Template Parameters
-
T | The type of component to check for. |
- Returns
- True if the entity has a component of the specified type, otherwise false.
◆ Instantiate()
static void WoopWoop.Entity.Instantiate |
( |
Entity | entity | ) |
|
|
static |
Instantiates an entity by adding it to the list of entities and initializing its components.
- Parameters
-
entity | The entity to instantiate. |
◆ InternalUpdate()
void WoopWoop.Entity.InternalUpdate |
( |
float | deltaTime | ) |
|
Performs internal updates on all components attached to the entity.
◆ RemoveComponent()
void WoopWoop.Entity.RemoveComponent |
( |
Type | componentType | ) |
|
Removes the component of the specified type from the entity.
- Parameters
-
componentType | The type of component to remove. |
◆ RemoveComponent< T >()
Removes the component of the specified type from the entity.
- Template Parameters
-
T | The type of component to remove. |
◆ StopComponents()
static void WoopWoop.Entity.StopComponents |
( |
Entity | entity | ) |
|
|
staticprivate |
Stops all components attached to an entity.
- Parameters
-
entity | The entity whose components to stop. |
◆ Update()
virtual void WoopWoop.Entity.Update |
( |
float | deltaTime | ) |
|
|
virtual |
◆ components
HashSet<Component> WoopWoop.Entity.components |
|
private |
List of components attached to the entity.
◆ componentsLock
readonly object WoopWoop.Entity.componentsLock = new() |
|
private |
Lock object for synchronizing access to the components list.
◆ enabled
bool WoopWoop.Entity.enabled = true |
|
private |
Indicates whether the entity is enabled.
◆ entities
List<Entity> WoopWoop.Entity.entities = new() |
|
staticprivate |
List of all entities in the game.
◆ ID
readonly string WoopWoop.Entity.ID |
Unique identifier for the entity.
◆ Name
string WoopWoop.Entity.Name |
◆ OnEntityDestroyed
Action<Entity> WoopWoop.Entity.OnEntityDestroyed |
|
static |
Event invoked when an entity is destroyed.
◆ OnEntityInstantiated
Action<Entity> WoopWoop.Entity.OnEntityInstantiated |
|
static |
Event invoked when an entity is instantiated.
◆ tag
string WoopWoop.Entity.tag = "" |
◆ transform
The transform component of the entity.
◆ Enabled
bool WoopWoop.Entity.Enabled |
|
getset |
Gets or sets a value indicating whether the entity is enabled.
The documentation for this class was generated from the following file: