Color legend plain property method
The face of a ComponentStore<T> for code that doesn’t know its T: the stores of different component types in one collection, and calls that know a component’s type only at run time.
An interface, in the namespace BorrowedTorch.ECS.Components.Base. The world keeps its stores as IComponentStore, and its type-erased calls go through it. The storage and performance page shows it in context. Like the store, it keys on the entity’s id alone, without generations.
Names are colored by what they are: a property or a method; values and fields keep the plain color.
Properties
ComponentType →
Type · Read-only. The type of the components the store holds.
Count →
int · Read-only. How many entities have a component in the store.
Methods
GetBoxed() →
GetBoxed(Entity e) · The entity’s component as an object: a boxed copy for a struct, the object itself for a class. Throws KeyNotFoundException when the entity has none.
| Parameter | Type | Description |
|---|---|---|
e |
Entity |
The entity whose component to get. |
Has() →
Has(Entity e) · Whether an entity with the id has a component here. Generations aren’t checked.
| Parameter | Type | Description |
|---|---|---|
e |
Entity |
The entity to ask about. |
Remove() →
Remove(Entity e) · Removes the component of the entity with the id, if there is one.
| Parameter | Type | Description |
|---|---|---|
e |
Entity |
The entity whose component to remove. |
SetBoxed() →
SetBoxed(Entity e, object component) · Adds or overwrites the entity’s component from an object of ComponentType. Throws ArgumentException for an object of any other type, null included, and ArgumentOutOfRangeException for a negative id.
| Parameter | Type | Description |
|---|---|---|
e |
Entity |
The entity whose component to set. |
component |
object |
The component, of the store’s type. |