Class EntityStore

Namespace
TDMaker.Core
Assembly
TDMaker.Core.dll

Deferred entity storage with stable iteration order and prewarmed component bundles.

public sealed class EntityStore
Inheritance
EntityStore
Inherited Members

Properties

All

Committed entities, ordered by ascending Id.

public IReadOnlyList<Entity> All { get; }

Property Value

IReadOnlyList<Entity>

AvailableCapacity

Unused prewarmed entity bundles, including all component arrays.

public int AvailableCapacity { get; }

Property Value

int

Enemies

Committed enemy index.

public IReadOnlyList<Entity> Enemies { get; }

Property Value

IReadOnlyList<Entity>

Heroes

Committed independent heroes, also included in Soldiers.

public IReadOnlyList<Entity> Heroes { get; }

Property Value

IReadOnlyList<Entity>

PendingCount

Number of pending noncancelled insertions.

public int PendingCount { get; }

Property Value

int

Projectiles

Committed projectile index.

public IReadOnlyList<Entity> Projectiles { get; }

Property Value

IReadOnlyList<Entity>

Soldiers

Committed soldier index.

public IReadOnlyList<Entity> Soldiers { get; }

Property Value

IReadOnlyList<Entity>

Towers

Committed tower index.

public IReadOnlyList<Entity> Towers { get; }

Property Value

IReadOnlyList<Entity>

Methods

Flush()

Commits queued removals and spawns; Simulation calls this once at each tick end.

public void Flush()

Get(int)

Finds committed or pending entities. Removed identifiers always return null.

public Entity Get(int id)

Parameters

id int

Returns

Entity

Remove(int)

Queues removal, including pending spawns, and releases owned soldiers.

public void Remove(int id)

Parameters

id int

Spawn(string, Vec2)

Queues an unindexed template entity at a position; use commands or SpawnEnemy for indexed roles.

public Entity Spawn(string templateId, Vec2 position)

Parameters

templateId string
position Vec2

Returns

Entity