-
-
Notifications
You must be signed in to change notification settings - Fork 11
EntityStateMachine
This is a state machine for an entity. The state machine manages a set of states, each of which has a set of component providers. When the state machine changes the state, it removes components associated with the previous state and adds components associated with the new state.
public class EntityStateMachine<StateIdentifier: Hashable>
- StateIdentifier: Generic hashable state name type
Initializer. Creates an EntityStateMachine.
public init(entity: Entity)
The entity whose state machine this is
var entity: Entity
Add a state to this state machine.
@discardableResult public func addState(name: StateIdentifier, state: EntityState) -> Self
- name: The name of this state - used to identify it later in the changeState method call.
- state: The state.
This state machine, so methods can be chained.
Create a new state in this state machine.
public func createState(name: StateIdentifier) -> EntityState
- name: The name of the new state - used to identify it later in the changeState method call.
The new EntityState object that is the state. This will need to be configured with the appropriate component providers.
Change to a new state. The components from the old state will be removed and the components for the new state will be added.
public func changeState(name: StateIdentifier)
- name: The name of the state to change to.
Generated at 2020-11-25T10:28:11+0000 using swift-doc 1.0.0-beta.5.
Types
- ComponentAdded
- ComponentIdentifier
- ComponentInstanceProvider
- ComponentRemoved
- ComponentSingletonProvider
- ComponentTypeProvider
- ComponentsBuilder.Context
- ComponentsBuilderPreview
- DefaultCodingStrategy
- DynamicCodingKey
- DynamicComponentProvider
- DynamicComponentProvider.Closure
- Entity
- Entity.ComponentsIterator
- EntityCreated
- EntityDestroyed
- EntityIdentifier
- EntityState
- EntityStateMachine
- Family
- Family.ComponentsIterator
- Family.EntityComponentIterator
- Family.EntityIterator
- FamilyMemberAdded
- FamilyMemberBuilderPreview
- FamilyMemberRemoved
- FamilyTraitSet
- LinearIncrementingEntityIdGenerator
- ManagedContiguousArray
- Nexus
- Nexus.EntitiesIterator
- Requires1
- Requires2
- Requires3
- Requires4
- Requires5
- Requires6
- Requires7
- Requires8
- Single
- StateComponentMapping
- StringHashing
- UnorderedSparseSet
- UnorderedSparseSet.ElementIterator
Protocols
- CodingStrategy
- Component
- ComponentProvider
- DefaultInitializable
- EntityIdentifierGenerator
- FamilyDecoding
- FamilyEncoding
- FamilyRequirementsManaging
- NexusEvent
- NexusEventDelegate
- RequiringComponents1
- RequiringComponents2
- RequiringComponents3
- RequiringComponents4
- RequiringComponents5
- RequiringComponents6
- RequiringComponents7
- RequiringComponents8
- SingleComponent
- TopLevelDecoder
- TopLevelEncoder