Entity Class - NocturnalWisp/Tynted-Engine GitHub Wiki

Usage

A representation of an entity in a class and handling of creating templates or cloning.

Entity ID (field)

Summary An integer representing the entity.

Type

  • int

Constructor

Summary Creates an entity by id

Implementation

Entity(int entityID)

Vars

  • entityID - The id of the entity to create.

Get Component

Summary Returns a component on the entity if it has one.

Implementation

GetComponent<T>() where T : IComponent

Vars

  • T - The type of component to attempt to find.

Returns

  • T - A reference to the component if found.

Entity Templates

These help to create entities quickly instead of from scratch all the time.

Create Empty

Summary Creates and returns a new entity with no components attached.

Implementation

Entity.CreateEmpty(string name, string tag(optional), string scene(optional))

Vars

  • name - The name of the entity.
  • tag - The tag of the entity.
  • scene - The scene of the entity.

Create Transform

Summary Creates and returns a new entity with a transform attatched.

Implementation

Entity.CreateTransform(string name, string tag(optional), string scene(optional))

Vars

  • name - The name of the entity.
  • tag - The tag of the entity.
  • scene - The scene of the entity.

Create Sprite

Summary Creates and returns a new entity with a Transform and a SpriteRenderee component attached.

Implementation

Entity.CreateSprite(string name, Texture texture, string tag(optional), string scene(optional))

Vars

  • name - The name of the entity.
  • texture - The texture of the SpriteRenderee component.
  • tag - The tag of the entity.
  • scene - The scene of the entity.

Clone Entity

Summary Duplicates an entity.

Implementation

Entity.CloneEntity(string clonable, string entityName, string clonableTag, string clonableSceneName)

Vars

  • clonable - The name of the entity to clone.
  • entityName - The name of the new entity.
  • clonableTag - The tag of the entity to clone.
  • clonableSceneName - The scene of the entity to clone.