WoopWoop-Docs
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
WoopWoop.Entity Class Reference

Represents an entity in the game world. More...

Classes

class  EntityCreator
 Class responsible for creating entities and configuring their properties. More...
 

Public Member Functions

 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.
 
AddComponent< T > ()
 Adds a new component of type T to the entity.
 
AddComponent< T > (T comp)
 Adds a specific component instance to the entity.
 
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.
 

Static Public Member Functions

static void Instantiate (Entity entity)
 Instantiates an entity by adding it to the list of entities and initializing its components.
 
static Entity[] GetAllEntities ()
 Retrieves an array containing all entities in the game.
 
static Entity GetEntityWithUUID (string uuid)
 Retrieves an entity with the specified UUID.
 
static Entity[] GetEntitiesWithTag (string tag)
 Retrieves all entities with the specified tag.
 
static void Destroy (Entity entity)
 Destroys an entity, removing it from the list of entities and stopping its components.
 
static EntityCreator CreateEntity ()
 Creates a new entity creator.
 

Public Attributes

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.
 

Static Public Attributes

static Action< EntityOnEntityDestroyed
 Event invoked when an entity is destroyed.
 
static Action< EntityOnEntityInstantiated
 Event invoked when an entity is instantiated.
 

Properties

bool Enabled [get, set]
 Gets or sets a value indicating whether the entity is enabled.
 

Static Private Member Functions

static void StopComponents (Entity entity)
 Stops all components attached to an entity.
 

Private Attributes

HashSet< Componentcomponents
 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 Private Attributes

static List< Entityentities = new()
 List of all entities in the game.
 

Detailed Description

Represents an entity in the game world.

Constructor & Destructor Documentation

◆ 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
xThe initial x-coordinate of the entity.
yThe initial y-coordinate of the entity.

◆ Entity() [3/3]

WoopWoop.Entity.Entity ( Vector2 startPos)

Initializes a new instance of the Entity class.

Parameters
startPosThe initial position of the entity.

Member Function Documentation

◆ AddComponent< T >() [1/2]

T WoopWoop.Entity.AddComponent< T > ( )

Adds a new component of type T to the entity.

Template Parameters
TThe type of component to add.
Returns
The added component.
Type Constraints
T :Component 
T :new() 

◆ AddComponent< T >() [2/2]

T WoopWoop.Entity.AddComponent< T > ( T comp)

Adds a specific component instance to the entity.

Template Parameters
TThe type of the component to add.
Parameters
compThe instance of the component to add.
Returns
The added component.
Type Constraints
T :Component 

◆ CreateEntity()

static EntityCreator WoopWoop.Entity.CreateEntity ( )
static

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
entityThe 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
TThe type of component to get.
Returns
The component of type T, or null if not found.
Type Constraints
T :Component 

◆ 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
tagThe 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
uuidThe 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
TThe type of component to check for.
Returns
True if the entity has a component of the specified type, otherwise false.
Type Constraints
T :Component 

◆ HasComponentOfType()

bool WoopWoop.Entity.HasComponentOfType ( Type componentType)

Checks if the entity has a component of the specified type attached.

Parameters
componentTypeThe 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
TThe type of component to check for.
Returns
True if the entity has a component of the specified type, otherwise false.
Type Constraints
T :Component 

◆ 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
entityThe 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
componentTypeThe type of component to remove.

◆ RemoveComponent< T >()

Removes the component of the specified type from the entity.

Template Parameters
TThe type of component to remove.
Type Constraints
T :Component 

◆ StopComponents()

static void WoopWoop.Entity.StopComponents ( Entity entity)
staticprivate

Stops all components attached to an entity.

Parameters
entityThe entity whose components to stop.

◆ Update()

virtual void WoopWoop.Entity.Update ( float deltaTime)
virtual

Updates the entity.

Member Data Documentation

◆ 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

The name of the entity.

◆ 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 = ""

The tag of the entity.

◆ transform

Transform WoopWoop.Entity.transform

The transform component of the entity.

Property Documentation

◆ 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: