Search Results for

    Show / Hide Table of Contents

    Class FixedSMBehaviour

    Abstract state machine to manage a set of given states and transitions. Supports basic unity events for unity updates and features.

    Inheritance
    Object
    FixedSMBehaviour
    FixedSMAnim
    Implements
    IStateMachine<Type>
    Namespace: nickmaltbie.StateMachineUnity.Fixed
    Assembly: cs.temp.dll.dll
    Syntax
    public abstract class FixedSMBehaviour : MonoBehaviour, IStateMachine<Type>

    Constructors

    FixedSMBehaviour()

    Initializes a state machine and will set the initial state to the state defined under this class with a InitialStateAttribute.

    Declaration
    public FixedSMBehaviour()

    Fields

    deltaTimeInCurrentState

    Delta time from the unity update function in the current state.

    Declaration
    protected float deltaTimeInCurrentState
    Field Value
    Type Description
    Single

    fixedDeltaTimeInCurrentState

    Fixed delta time from the unity fixed update function in the current state.

    Declaration
    protected float fixedDeltaTimeInCurrentState
    Field Value
    Type Description
    Single

    unityService

    Unity service for managing getting static unity values in a testable manner.

    Declaration
    public IUnityService unityService
    Field Value
    Type Description
    IUnityService

    Properties

    CurrentState

    Current state of the state machine.

    Declaration
    public Type CurrentState { get; }
    Property Value
    Type Description
    Type

    Methods

    FixedUpdate()

    Update the fixedDeltaTimeInCurrentState based on the IUnityService.fixedDeltaTime as well as raising an instance of the OnFixedUpdateEvent for this state machine.

    Declaration
    public virtual void FixedUpdate()

    LateUpdate()

    Raises an instance of the OnLateUpdateEvent for this state machine.

    Declaration
    public virtual void LateUpdate()

    OnAnimatorIK()

    Raises an instance of the OnAnimatorIKEvent for this state machine.

    Declaration
    public virtual void OnAnimatorIK()

    OnDisable()

    Raises an instance of the OnDisableEvent for this state machine.

    Declaration
    public virtual void OnDisable()

    OnEnable()

    Raises an instance of the OnEnableEvent for this state machine.

    Declaration
    public virtual void OnEnable()

    OnGUI()

    Raises an instance of the OnGUIEvent for this state machine.

    Declaration
    public virtual void OnGUI()

    RaiseEvent(IEvent)

    Raise a synchronous event for a given state machine.
    First checks if this state machine expects any events of this type for the state machine's CurrentState. These would follow an attribute of type OnEventDoActionAttribute.
    If the state machine's CurrentState expects a transition based on the event, then this will trigger the OnExitStateAttribute of the CurrentState, change to the next state defined in the TransitionAttribute, then trigger the OnEnterStateAttribute of the next state.

    Declaration
    public virtual void RaiseEvent(IEvent evt)
    Parameters
    Type Name Description
    IEvent evt

    Event to send to this state machine.

    SetStateQuiet(Type)

    Internal method to set the current state of the state machine without invoking the OnEnterStateAttribute or OnExitStateAttribute

    Declaration
    public void SetStateQuiet(Type newState)
    Parameters
    Type Name Description
    Type newState

    New state to set for the state machine.

    Update()

    Update the deltaTimeInCurrentState based on the IUnityService.deltaTime as well as raising an instance of the OnUpdateEvent for this state machine.

    Declaration
    public virtual void Update()

    Implements

    IStateMachine<E>
    In This Article
    Back to top State Machine Unity Documentation