.. _state-class: State ===== Namespace --------- .. code-block:: csharp namespace Handy2DTools.Actions{} Declaration ----------- .. code-block:: csharp public abstract class State : MonoBehaviour {} Fields ---------- .. table:: :width: 100% :widths: 25 15 60 +-----------------------------------------------+----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``new protected string`` | ``name`` | A name you can give the state (you can use the inspector) |br| so you can have a visual feeeback at the :ref:`StateMachine ` inspector | +-----------------------------------------------+----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``protected StateMachine`` | ``machine`` | The state machine. Set inside InternalLoad() method wich is called by the machine. | +-----------------------------------------------+----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``protected Actor`` | ``actor`` | The machine's actor. Set inside InternalLoad() method wich is called by the machine. | +-----------------------------------------------+----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Properties ---------- .. table:: :width: 100% :widths: 45 15 40 +-----------------------------------------------------------------------+----------------------------+---------------------------------------------------------------------------------+ | ``public List { get; protected set; }`` | ``transitions`` | List of transitions for this state. | +-----------------------------------------------------------------------+----------------------------+---------------------------------------------------------------------------------+ | ``public string { get; }`` | ``Name`` | Either the set ``name`` or the state ``Type`` | +-----------------------------------------------------------------------+----------------------------+---------------------------------------------------------------------------------+ Methods ---------- .. table:: :width: 100% :widths: 45 15 40 +-----------------------------------------------+----------------------------+----------------------------------------------------------------------------------------------------------------------+ | ``public virtual void`` | ``InternalLoad`` | Called by the :ref:`StateMachine ` to load important functionalities. | +-----------------------------------------------+----------------------------+----------------------------------------------------------------------------------------------------------------------+ | ``public virtual void`` | ``SortTransitions`` | Reorders ``transitions`` considering priority levels | +-----------------------------------------------+----------------------------+----------------------------------------------------------------------------------------------------------------------+ | ``protected virtual void`` | ``AddTransition()`` | Called to register a :ref:`StateTransition `. Must be called inside ``State.OnLoad()`` | +-----------------------------------------------+----------------------------+----------------------------------------------------------------------------------------------------------------------+ | Arguments: ``Func Condition``, ``State state``, ``int priority = 0`` | +-----------------------------------------------+----------------------------+----------------------------------------------------------------------------------------------------------------------+ | ``protected virtual void`` | ``AddTransition()`` | Called to register a :ref:`StateTransition `. Must be called inside ``State.OnLoad()`` | +-----------------------------------------------+----------------------------+----------------------------------------------------------------------------------------------------------------------+ | Arguments: ``StateTransition transition`` | +-----------------------------------------------+----------------------------+----------------------------------------------------------------------------------------------------------------------+ | .. HTML Substiuions .. |br| raw:: html