Search Results for

    Show / Hide Table of Contents

    Class StateMachine

    State machine logic pattern

    Inheritance
    System.Object
    StateMachine
    Namespace: FlaxEngine.Utilities
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    public abstract class StateMachine : Object

    Constructors

    StateMachine()

    Declaration
    protected StateMachine()

    Fields

    currentState

    The current state.

    Declaration
    protected State currentState
    Field Value
    State

    states

    The states.

    Declaration
    protected readonly List<State> states
    Field Value
    System.Collections.Generic.List<State>

    Properties

    CurrentState

    Gets the current state.

    Declaration
    public State CurrentState { get; }
    Property Value
    State

    States

    Gets the states (read-only).

    Declaration
    public IReadOnlyList<State> States { get; }
    Property Value
    System.Collections.Generic.IReadOnlyList<State>

    Methods

    AddState(State)

    Adds the state.

    Declaration
    public virtual void AddState(State state)
    Parameters
    State state

    The state.

    GetState<TStateType>()

    Gets state of given type.

    Declaration
    public State GetState<TStateType>()
    Returns
    State

    Type Parameters
    TStateType

    The type of the state.

    GoToState(State)

    Goes to the state.

    Declaration
    public virtual void GoToState(State state)
    Parameters
    State state

    The target state.

    Exceptions
    System.ArgumentNullException

    state

    GoToState<TStateType>()

    Goes to the state.

    Declaration
    public void GoToState<TStateType>()
    Type Parameters
    TStateType

    The type of the state.

    Exceptions
    System.InvalidOperationException

    Cannot find state of given type.

    RemoveState(State)

    Removes the state.

    Declaration
    public virtual void RemoveState(State state)
    Parameters
    State state

    The state.

    SwitchState(State)

    Switches the state.

    Declaration
    protected virtual void SwitchState(State nextState)
    Parameters
    State nextState

    Then next state.

    Events

    StateChanged

    Occurs when state gets changed.

    Declaration
    public event Action StateChanged
    Event Type
    System.Action

    StateChanging

    Occurs when state is being changed.

    Declaration
    public event Action StateChanging
    Event Type
    System.Action

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat