Skip to content
Mariusz edited this page May 21, 2020 · 3 revisions

The Nyu class is the core class of every entity in the NyuEntities system; It handles execution order with interfaces instead of reflection methods like unity does.

Supported interfaces: INyuAwake, INyuStart, INyuUpdate, INyuFixedUpdate, INyuLateUpdate, INyuOnDestroyQueued, INyuOnDestroy, INyuOnEnable, INyuOnDisable, INyuOnTriggerEnter, INyuOnTriggerEnter2D, INyuOnTriggerExit, INyuOnTriggerExit2D, INyuOnCollisionEnter, INyuOnCollisionEnter2D, INyuOnCollisionExit, INyuOnCollisionExit2D.

All of these interfaces are located in the WarWolfWorks.Interfaces.NyuEntities namespace.

Public Methods

T AddNyuComponent<T>() where T : Component, INyuComponent

Attempts to add a new entity component to the parent.

T ANC<T>() where T : Component, INyuComponent

Attempts to add a new entity component to the parent.

INyuComponent AddNyuComponent(Type)

Attempts to add a new entity component to the parent.

INyuComponent ANC(Type type)

Attempts to add a new entity component to the parent.

T GetNyuComponent<T>()

Attempts to retrieve a INyuComponent or NyuComponent from the parent. Returns null if none were found.

T GNC<T>()

Attempts to retrieve a INyuComponent or NyuComponent from the parent. Returns null if none were found.

INyuComponent GNC(Type)

Attempts to retrieve a INyuComponent or NyuComponent from the parent and returns it as INyuComponent. Returns null if none were found.

List<INyuComponent> GetNyuComponents()

Retrieves all INyuComponent and NyuComponent components from the parent.

bool RemoveNyuComponent(INyuComponent)

Removes an existing INyuComponent or NyuComponent.

bool RemoveNyuComponent(Type type)

Attempts to remove the first INyuComponent or NyuComponent of given type.

bool RemoveNyuComponent<T>()

Attempts to remove the first INyuComponent or NyuComponent of given T type.

bool RNC(INyuComponent)

Removes an existing INyuComponent or NyuComponent.

bool RNC(Type type)

Attempts to remove the first INyuComponent or NyuComponent of given type.

bool RNC<T>()

Attempts to remove the first INyuComponent or NyuComponent of given T type.

bool TryGetNyuComponent<T>(out T component)

Attempts to retrieve the first INyuComponent or NyuComponent of given T type; If none were found, the method will return false and component will be null.

bool TGNC<T>(out T component)

Attempts to retrieve the first INyuComponent or NyuComponent of given T type; If none were found, the method will return false and component will be null.

Public Properties

Vector3 EulerAngles

Pointer to transform.eulerAngles.

Quaternion Rotation

Pointer to transform.rotation.

Vector3 Position

Pointer to transform.position.

string Tag

A string value used to identify an entity through a specific tag; Can be used for any reason.

Stats Stats (get-only)

A class which handles all stats of the given entity. For more info, check out the Stats System.

Event Actions

Action OnDestroyBegin

Invoked right after this entity is queued for destruction using EntityManager.Destroy.

Action OnEnabled

Invoked when this entity is enabled.

Action OnDisabled

Invoked when this entity is disabled.

Operators

implicit operator Transform(Nyu)

Makes it possible to pass any Nyu as a Transform argument.

Clone this wiki locally