Grouping entity and component creation and handling here. More...
Classes | |
struct | Quantum.EntityRef |
Quantum entity reference. More... | |
class | Quantum.Core.FrameBase |
The Frame class is the container for all the transient and static game state data, including the API for entities, physics, assets and others. More... | |
struct | Quantum.Core.FrameBase.FrameBaseUnsafe |
Frame API to give access to C# unsafe pointers and advanced immediate operations. More... | |
Functions | |
AddResult | Quantum.Core.FrameBase.Add (EntityRef entity, int componentIndex, out void *result) |
Adds a component of default value to an entity and returns a pointer to the added component. More... | |
AddResult | Quantum.Core.FrameBase.Add (EntityRef entity, int componentIndex, void *value) |
Adds a component of defined value to an entity More... | |
AddResult | Quantum.Core.FrameBase.Add (EntityRef entity, int componentIndex, void *value, out void *result) |
Adds a component of defined value to an entity and returns a pointer to the added component. More... | |
AddResult | Quantum.Core.FrameBase.Add< T > (EntityRef entity) |
Adds a default component to an entity. More... | |
AddResult | Quantum.Core.FrameBase.Add< T > (EntityRef entity, out T *result) |
Adds a component of default value to an entity and returns a pointer to the added component. More... | |
AddResult | Quantum.Core.FrameBase.Add< T > (EntityRef entity, T value) |
Adds a component to an entity. More... | |
AddResult | Quantum.Core.FrameBase.Add< T > (EntityRef entity, T value, out T *result) |
Adds a component of defined value to an entity and returns a pointer to the added component. More... | |
bool | Quantum.Core.FrameBase.AddOrGet (EntityRef entity, int componentIndex, out void *result) |
Adds a component of default value to an entity (if it does not have that component yet) and gets a pointer to the component. More... | |
bool | Quantum.Core.FrameBase.AddOrGet< T > (EntityRef entity, out T *result) |
Adds a component of default value to an entity (if it does not have that component yet) and gets a pointer to the component. More... | |
EntityRef | Quantum.Core.FrameBase.Create () |
Creates an entity that is saved in the game state. More... | |
EntityRef | Quantum.Core.FrameBase.Create (AssetRefEntityPrototype prototype) |
Creates an entity from a prototype asset. This process is also reffered to as "prototype materialization". More... | |
EntityRef | Quantum.Core.FrameBase.Create (EntityPrototype prototype) |
Creates an entity from a prototype. This process is also reffered to as "prototype materialization". More... | |
void | Quantum.Core.FrameBase.Create (EntityPrototypeContainer[] prototypes, Map parentAsset) |
Creates (materializes) map prototypes. The difference between this method and calling Create(EntityPrototype) repeatedly is that EntityRef fields get resolved and that MapEntityLink components are added implicitly. More... | |
bool | Quantum.Core.FrameBase.Destroy (EntityRef entityRef) |
Destroys the entity and all components that were added to it. More... | |
bool | Quantum.Core.FrameBase.Exists (EntityRef entityRef) |
Checks if an entity is still valid. More... | |
T | Quantum.Core.FrameBase.Get< T > (EntityRef entityRef) |
Gets a component from an entity. More... | |
ComponentIterator< T > | Quantum.Core.FrameBase.GetComponentIterator< T > () |
Create a component iterator for all components of one type. More... | |
ComponentSet | Quantum.Core.FrameBase.GetComponentSet (EntityRef entityRef) |
Gets a set of all component types that were added to the entity. More... | |
T * | Quantum.Core.FrameBase.FrameBaseUnsafe.GetPointer< T > (EntityRef entityRef) |
Gets a pointer to a component that can be changed directly without writing the component back with Set<T>(EntityRef, T). More... | |
bool | Quantum.Core.FrameBase.Has (EntityRef entityRef, ComponentSet set) |
Checks if the entity contains a whole set of components. More... | |
bool | Quantum.Core.FrameBase.Remove (EntityRef entityRef, int componentIndex) |
Removes a component from an entity. More... | |
bool | Quantum.Core.FrameBase.Remove (EntityRef entityRef, Type componentType) |
Removes a component from an entity. More... | |
bool | Quantum.Core.FrameBase.Remove< T > (EntityRef entityRef) |
Removes a component from an entity. More... | |
SetResult | Quantum.Core.FrameBase.Set (EntityRef entity, EntityPrototype prototype) |
Adds (materializes) components to an already existing entity. If a component already exists, it will get completely overwritten, but an error message will be logged. To avoid errors in such case use Set(EntityRef, EntityPrototype, out ComponentSet) instead. More... | |
SetResult | Quantum.Core.FrameBase.Set (EntityRef entity, EntityPrototype prototype, out ComponentSet overwrittenComponents) |
Adds (materializes) components to an already existing entity. If a component already exists, it will get completely overwritten. More... | |
SetResult | Quantum.Core.FrameBase.Set (EntityRef entity, int componentIndex, void *value) |
Sets a component on an entity. More... | |
SetResult | Quantum.Core.FrameBase.Set< T > (EntityRef entity, T value) |
Sets a component on an entity. More... | |
bool | Quantum.Core.FrameBase.TryGet< T > (EntityRef entityRef, out T value) |
Gets a component from an entity. Does not throw when the component does not exist. More... | |
bool | Quantum.Core.FrameBase.TryGetComponentSet (EntityRef entityRef, out ComponentSet set) |
Gets a set of all component types that were added to the entity. More... | |
bool | Quantum.Core.FrameBase.FrameBaseUnsafe.TryGetPointer< T > (EntityRef entityRef, out T *value) |
Similar to GetPointer<T>(EntityRef) but does not throw an exception if the component is not present. More... | |
Grouping entity and component creation and handling here.
|
inline |
Adds a default component to an entity.
T | Component type |
entity | Entity reference |
Internally calls Has<T>(EntityRef) and Set<T>(EntityRef, T)
InvalidOperationException | Thrown when the entity does not exist |
InvalidOperationException | Thrown when entity already has a component of the given type |
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Checks if the entity contains a whole set of components.
entityRef | Entity reference |
set | Set of component types |
|
inline |
Checks if an entity is still valid.
For example handy for when you store the entity as a reference inside other components.
entityRef | Entity reference |
|
inline |
Create a component iterator for all components of one type.
T | Component type |
Changed components have to be Set<T>(EntityRef, T) back.
Accessing the component array creates a copy of the component.
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Adds a component to an entity.
T | Component type |
entity | Entity reference |
value | Value of the component to be added |
Internally calls Has<T>(EntityRef) and Set<T>(EntityRef, T)
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Adds a component of default value to an entity and returns a pointer to the added component.
T | Component type |
entity | Entity reference |
result | A pointer to the component added. Null if the result is not AddResult.ComponentAdded. |
Internally calls Has<T>(EntityRef) and Set<T>(EntityRef, T)
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Adds a component of defined value to an entity and returns a pointer to the added component.
T | Component type |
entity | Entity reference |
value | Value of the component to be added |
result | A pointer to the component added. Null if the result is not AddResult.ComponentAdded. |
Internally calls Has<T>(EntityRef) and Set<T>(EntityRef, T)
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Adds a component of defined value to an entity
entity | Entity reference |
componentIndex | The index of the component to be added. See also ComponentTypeId.GetComponentIndex(Type) or ComponentTypeId<T>.Id to retrieve the index of a component type. |
value | A pointer to data that should be copied as value to the component added. If null, the component is added with default value. |
Internally calls Has<T>(EntityRef) and Set<T>(EntityRef, T)
|
inline |
Adds a component of default value to an entity and returns a pointer to the added component.
entity | Entity reference |
componentIndex | The index of the component to be added. See also ComponentTypeId.GetComponentIndex(Type) or ComponentTypeId<T>.Id to retrieve the index of a component type. |
result | A pointer to the component added. Null if the result is not AddResult.ComponentAdded. |
Internally calls Has<T>(EntityRef) and Set<T>(EntityRef, T)
|
inline |
Adds a component of defined value to an entity and returns a pointer to the added component.
entity | Entity reference |
componentIndex | The index of the component to be added. See also ComponentTypeId.GetComponentIndex(Type) or ComponentTypeId<T>.Id to retrieve the index of a component type. |
value | A pointer to data that should be copied as value to the component added. If null, the component is added with default value. |
result | A pointer to the component added. Null if the result is not AddResult.ComponentAdded. |
Internally calls Has<T>(EntityRef) and Set<T>(EntityRef, T)
IndexOutOfRangeException | If the componentIndex does not identify a valid component. |
|
inline |
Adds a component of default value to an entity (if it does not have that component yet) and gets a pointer to the component.
entity | Entity reference |
result | A pointer to the component added or already existing. Null if the entity does not exist. |
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Adds a component of default value to an entity (if it does not have that component yet) and gets a pointer to the component.
entity | Entity reference |
componentIndex | The index of the component to be added. See also ComponentTypeId.GetComponentIndex(Type) or ComponentTypeId<T>.Id to retrieve the index of a component type. |
result | A pointer to the component added or already existing. Null if the entity does not exist. |
IndexOutOfRangeException | If the componentIndex does not identify a valid component. |
|
inline |
Sets a component on an entity.
T | Component type |
entity | Entity ref |
value | Value of the component to be added |
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Sets a component on an entity.
entity | Entity ref |
componentIndex | The index of the component being set. See also ComponentTypeId.GetComponentIndex(Type) or ComponentTypeId<T>.Id to get the index of a component. |
value | A pointer to data that should be copied as value to the component. If null, the component is set with default value. |
IndexOutOfRangeException | If the componentIndex does not identify a valid component. |
|
inline |
Gets a component from an entity.
T | Component type |
entityRef | Entity reference |
Modified components need to be explicitly written back by using Set<T>(EntityRef, T).
Use Has<T>(EntityRef) to quickly check the entity for component availability.
InvalidOperationException | Thrown when the entity does not exist |
InvalidOperationException | Thrown when the component does not exists on entity |
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Gets a component from an entity. Does not throw when the component does not exist.
T | Component type |
entityRef | Entity reference |
value | Requested component |
InvalidOperationException | Thrown when the entity does not exist |
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Removes a component from an entity.
T | Component type |
entityRef | Entity reference |
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Removes a component from an entity.
entityRef | Entity reference |
componentType | Component type |
|
inline |
Removes a component from an entity.
entityRef | Entity reference |
componentIndex | The index of the component to be removed. |
IndexOutOfRangeException | If the componentIndex does not identify a valid component. |
|
inline |
Gets a set of all component types that were added to the entity.
entityRef | Entity reference |
|
inline |
Gets a set of all component types that were added to the entity.
entityRef | Entity reference |
set |
|
inline |
Destroys the entity and all components that were added to it.
The destruction takes immediate effect, i.e., Exists will start to return false. The old data, however, will remain in memory until destroy/remove commands are committed, according to the CommitCommandsMode or manually through FrameBaseUnsafe.CommitAllCommands().
entityRef |
|
inline |
Creates an entity from a prototype asset. This process is also reffered to as "prototype materialization".
prototype |
|
inline |
Creates an entity from a prototype. This process is also reffered to as "prototype materialization".
The steps are following:
prototype |
|
inline |
Creates (materializes) map prototypes. The difference between this method and calling Create(EntityPrototype) repeatedly is that EntityRef fields get resolved and that MapEntityLink components are added implicitly.
This is a multi-step process:
prototypes | |
parentAsset |
|
inline |
Adds (materializes) components to an already existing entity. If a component already exists, it will get completely overwritten, but an error message will be logged. To avoid errors in such case use Set(EntityRef, EntityPrototype, out ComponentSet) instead.
The steps are following:
entity | |
prototype |
|
inline |
Adds (materializes) components to an already existing entity. If a component already exists, it will get completely overwritten.
The steps are following:
entity | |
prototype | |
overwrittenComponents | Components that have been overwritten. |
|
inline |
Creates an entity that is saved in the game state.
|
inline |
Gets a pointer to a component that can be changed directly without writing the component back with Set<T>(EntityRef, T).
T | Component type |
entityRef | Entity reference |
InvalidOperationException | Thrown when the entity does not exist |
InvalidOperationException | Thrown when the entity does have the requested component type. |
Always check the availability of the component with Has(EntityRef, ComponentSet) before using this method.
T | : | unmanaged | |
T | : | IComponent |
|
inline |
Similar to GetPointer<T>(EntityRef) but does not throw an exception if the component is not present.
T | Component type |
entityRef | Entity reference |
value | Resulting component pointer of null if the component was not found |
InvalidOperationException | Thrown when the entity does not exist |
T | : | unmanaged | |
T | : | IComponent |