Interface ISnapshotCapability
- Namespace
- KeenEyes.Capabilities
- Assembly
- KeenEyes.Abstractions.dll
Capability for world snapshot operations including creating and restoring world state.
public interface ISnapshotCapability
Remarks
This capability provides the operations needed for serializing and deserializing world state, including accessing all entities, components, and singletons.
The World class implements this capability. Plugin authors can use this interface to work with world snapshots without depending on the concrete World type.
Methods
Clear()
Clears all entities and state from the world.
void Clear()
GetAllSingletons()
Gets all singletons in the world as type/value pairs.
IEnumerable<(Type Type, object Value)> GetAllSingletons()
Returns
- IEnumerable<(Type Type, object Value)>
An enumerable of singleton type and value pairs.
GetComponents(Entity)
Gets all components on an entity as type/value pairs.
IEnumerable<(Type Type, object Value)> GetComponents(Entity entity)
Parameters
entityEntityThe entity to get components from.
Returns
- IEnumerable<(Type Type, object Value)>
An enumerable of component type and value pairs.
SetSingleton<T>(in T)
Sets a singleton value in the world.
void SetSingleton<T>(in T value) where T : struct
Parameters
valueTThe singleton value.
Type Parameters
TThe singleton type. Must be a value type.