Table of Contents

Class EntityManager

Namespace
TileWorld.Engine.Runtime.Entities
Assembly
TileWorld.Engine.dll

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

entityId int

The entity identifier to remove.

Returns

bool

true when the entity existed.

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

entityId int

The target player entity identifier.

moveAxis float

The horizontal movement axis in the range [-1, 1].

jumpRequested bool

Whether a jump should be attempted during the next update.

Spawn(EntitySpawnRequest)

Spawns an entity from an explicit request.

public int Spawn(EntitySpawnRequest request)

Parameters

request EntitySpawnRequest

The 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

itemDefId int

The dropped item definition identifier.

position Float2

The spawn position in world tile units.

amount int

The dropped amount.

Returns

int

The created drop entity identifier, or 0 when the item definition is invalid.

SpawnPlayer(Float2)

Spawns a controllable player prototype at the supplied position.

public int SpawnPlayer(Float2 position)

Parameters

position Float2

The 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

entityId int

The entity identifier to resolve.

entity Entity

The resolved entity when present.

Returns

bool

true when the entity exists.

Update(FrameTime)

Advances entity simulation for one frame.

public void Update(FrameTime frameTime)

Parameters

frameTime FrameTime

The current frame timing snapshot.