Class Entity
General object with logic which can spawn into the stage
Implements
Constructors
Entity()
Declaration
public Entity()
Properties
Active
True if the entity is currently in stage
Declaration
public bool Active { get; set; }
Center
Center position of the Rect in global space
Declaration
public Int2 Center { get; }
CenterX
Center position X of the Rect in global space
Declaration
public int CenterX { get; }
CenterY
Center position Y of the Rect in global space
Declaration
public int CenterY { get; }
FromWorld
True if the entity is spawned by the world squad
Declaration
public bool FromWorld { get; }
Height
Size Y of thie entity in global space
Declaration
public int Height { get; set; }
IgnoreReposition
True if the entity do not reposition when it out of view
Declaration
public bool IgnoreReposition { get; set; }
InstanceID
Unique ID for this entity as a instance on stage
Declaration
public Int3 InstanceID { get; }
InstanceOrder
Unique index for this entity that distinguish from other same-type entities on stage
Declaration
public int InstanceOrder { get; }
MapUnitPos
The position of this entity on the map in unit space
Declaration
public Int3? MapUnitPos { get; }
PivotUnitPosition
Position that this entity belongs to in unit space. Get the MapUnitPos when it's from world. Get rect center's unit position when not from world.
Declaration
public Int3 PivotUnitPosition { get; }
Rect
Rect position of this entity in global space
Declaration
public virtual IRect Rect { get; }
Size
Size in global space
Declaration
public Int2 Size { get; set; }
SpawnFrame
Which frame does this entity get spawned into the stage
Declaration
public int SpawnFrame { get; protected set; }
TypeID
Unique ID represent what type of entity is it
Declaration
public int TypeID { get; init; }
Width
Size X of thie entity in global space
Declaration
public int Width { get; set; }
X
Position X of this entity in global space
Declaration
public int X { get; set; }
XY
Position in global space
Declaration
public Int2 XY { get; set; }
Y
Position Y of this entity in global space
Declaration
public int Y { get; set; }
Methods
AfterReposition(Int3, Int3)
This function is called when the entity's map position got repositioned by stage
Declaration
public virtual void AfterReposition(Int3 fromUnitPos, Int3 toUnitPos)
BeforeUpdate()
[2/4] This function is called every frame when entity is in stage. Prioritize using this function to update physics logic.
Declaration
public virtual void BeforeUpdate()
CancelIgnoreDespawnFromMap()
Do not force this entity not despawn by stage
Declaration
public void CancelIgnoreDespawnFromMap()
Draw()
Draw this entity by it's type ID and rect position
Declaration
public Cell Draw()
FirstUpdate()
[1/4] This function is called every frame when entity is in stage. Prioritize using this function to fill collider in to physics system.
Declaration
public virtual void FirstUpdate()
IgnoreDespawnFromMap(int)
Force this entity not despawn by stage when out of range for given frames long
Declaration
public void IgnoreDespawnFromMap(int duration = 1)
LateUpdate()
[4/4] This function is called every frame when entity is in stage. Prioritize using this function to render the entity.
Declaration
public virtual void LateUpdate()
OnActivated()
This function is called when entity enter the stage
Declaration
public virtual void OnActivated()
OnInactivated()
This function is called when entity leave the stage
Declaration
public virtual void OnInactivated()
Update()
[3/4] This function is called every frame when entity is in stage. Prioritize using this function to update physics logic.
Declaration
public virtual void Update()