Class EntityManager
Manages prototype entities such as the player and collectible drops.
public sealed class EntityManager
- Inheritance
-
EntityManager
- Inherited Members
Remarks
This is a gameplay-facing API for prototype sandbox flows. It intentionally remains lightweight and non-ECS so the engine can evolve the entity model in later milestones without introducing backend-specific dependencies.
Methods
EnumerateEntities()
Enumerates all currently active entities.
public IEnumerable<Entity> EnumerateEntities()
Returns
- IEnumerable<Entity>
The active entities.
RemoveEntity(int)
Marks an entity for removal.
public bool RemoveEntity(int entityId)
Parameters
entityIdintThe entity identifier to remove.
Returns
SetPlayerInput(int, float, bool)
Applies player control input that should be consumed during the next update.
public void SetPlayerInput(int entityId, float moveAxis, bool jumpRequested)
Parameters
entityIdintThe target player entity identifier.
moveAxisfloatThe horizontal movement axis in the range [-1, 1].
jumpRequestedboolWhether a jump should be attempted during the next update.
Spawn(EntitySpawnRequest)
Spawns an entity from an explicit request.
public int Spawn(EntitySpawnRequest request)
Parameters
requestEntitySpawnRequestThe spawn request to realize.
Returns
- int
The created entity identifier.
SpawnDrop(int, Float2, int)
Spawns a collectible world drop at the supplied position.
public int SpawnDrop(int itemDefId, Float2 position, int amount = 1)
Parameters
itemDefIdintThe dropped item definition identifier.
positionFloat2The spawn position in world tile units.
amountintThe dropped amount.
Returns
- int
The created drop entity identifier, or
0when the item definition is invalid.
SpawnPlayer(Float2)
Spawns a controllable player prototype at the supplied position.
public int SpawnPlayer(Float2 position)
Parameters
positionFloat2The starting position in world tile units.
Returns
- int
The created player entity identifier.
TryGetEntity(int, out Entity)
Attempts to resolve an entity by identifier.
public bool TryGetEntity(int entityId, out Entity entity)
Parameters
Returns
Update(FrameTime)
Advances entity simulation for one frame.
public void Update(FrameTime frameTime)
Parameters
frameTimeFrameTimeThe current frame timing snapshot.