ECSManager Reference - NocturnalWisp/Tynted-Engine GitHub Wiki

Usage

The ECSManager is useful for handling various management practices across a game.

System and Component Utility Functions

These are used for adding or removing systems and components.

Add System

Summary
Adds a system to be run by the manager.

Implementation

AddSystem<T>() where T : System

Vars

  • T - System Type

Remove System

Summary
Removes a system from the manager.

Implementation

RemoveSystem<T>() where T : System

Vars

  • T - System Type

Add Component

Summary
Adds a component to be held by the manager.

Implementation

AddComponent<T>() where T : IComponent

Vars

  • T - IComponent Type

Remove Component

Summary
Removes a component from the manager.

Implementation

RemoveComponent<T>() where T : IComponent

Vars

  • T - System Type

Entity Utility Functions

Used to alter entities and their components.

Get Component Entity Active List

Summary
Returns a list of all the entity components of a type that are active.

Implementation

GetComponentEntityActiveList<T>() where T : IComponent

Vars

  • T - Component Type

Returns

  • List - Entity components of type T.

Get Component Entity List

Summary
Returns a list of all the entity components of a type.

Implementation

GetComponentEntityList<T>() where T : IComponent

Vars

  • T - Component type.

Returns

  • List - Entity components of type T.

Create Entity

Summary
Creates an entity.

Implementation

CreateEntity(string name, string tag = "Default", string scene = "")

Vars

  • name - Name of the entity.
  • tag - Tag of the new entity.
  • scene - Name of the scene of the entity.

Returns

  • int? - entityID if created.

Delete Entity

Summary
Deletes an entity.

Implementation

DeleteEntity(string name, string tag = "Default", string scene = "")

Vars

  • name - Name of the entity.
  • tag - Tag of the entity.
  • scene - Name of the scene of the entity.

Add Entity Component

Summary
Adds the component to the entity.

Implementation

AddEntityComponent(string entityName, IComponent component)

Vars

  • entityName - Name of the entity.
  • component - The component to add to the entity.

Register Entity Components

Summary
Adds multiple components to entities.

Implementation

RegisterEntityComponents(params EntityComponentIdentifier[] entityComponents)

Vars

Remove Entity Component

Summary
Removes a component from an entity.

Implementation

RemoveEntityComponent<T>(string entityName) where T : IComponent

Vars

  • T - Component type.
  • entityName - Name of the entity.

Get Entity Component

Summary
Returns the component of an entity.

Implementation

GetEntityComponent<T>(string entityName) where T : IComponent

Vars

  • T - Component type.
  • entityName - Name of the entity.

Returns

  • IComponent - The component if found.

Remove All Entity Components

Summary
Adds the component to the entity.

Implementation

RemoveAllEntityComponents(string entityName)

Vars

  • entityName - Name of the entity to remove components from.

Get Entity Components

Summary
Returns all the components an entity has.

Implementation

GetEntityComponents(string entityName)

Vars

  • entityName - Name of the entity.

Returns

  • List - All the components on the entity.

Events

These help to create and control events for systems.

Create Event

Summary
Creates a new event without any arguments.

Implementation

CreateEvent(string name)

Vars

  • name - The name of the event to create.

Returns

  • TyntedEvent - The event if created.

Create Event 1 Arg

Summary
Creates a new event with one argument.

Implementation

CreateEvent1Arg(string name)

Vars

  • name - The name of the event to create.

Returns

  • TyntedEvent - The event if created.

Create Event 2 Arg

Summary
Creates a new event with two arguments.

Implementation

CreateEvent2Arg(string name)

Vars

  • name - The name of the event to create.

Returns

  • TyntedEvent<object, object> - The event if created.

Subscribe Event

Summary
Subscribes to an event without any arguments.

Implementation

SubscribeEvent(string name, EngineAction action)

Vars

  • name - The name of the event subscribe to.
  • action - The action to call when the event is invoked.

Subscribe Event

Summary
Subscribes to an event with one argument.

Implementation

SubscribeEvent(string name, EngineAction<object> action)

Vars

  • name - The name of the event subscribe to.
  • action - The action to call when the event is invoked.

Subscribe Event

Summary
Subscribes to an event with two arguments.

Implementation

SubscribeEvent(string name, EngineAction<object, object> action)

Vars

  • name - The name of the event subscribe to.
  • action - The action to call when the event is invoked.

Un-Subscribe Event

Summary
Un-Subscribes from an event without any arguments.

Implementation

UnSubscribeEvent(string name, EngineAction action)

Vars

  • name - The name of the event un-subscribe from.
  • action - The action to remove the event caller from.

Un-Subscribe Event

Summary
Un-Subscribes from an event with one argument.

Implementation

UnSubscribeEvent(string name, EngineAction<object> action)

Vars

  • name - The name of the event un-subscribe from.
  • action - The action to remove the event caller from.

Un-Subscribe Event

Summary
Un-Subscribes from an event with two arguments.

Implementation

UnSubscribeEvent(string name, EngineAction<object, object> action)

Vars

  • name - The name of the event un-subscribe from.
  • action - The action to remove the event caller from.
⚠️ **GitHub.com Fallback** ⚠️