Example #1
0
 public static ActionState GetActionStateInstance(ActionState requestedActionStateType, StateMachine creatureStateMachine)
 {
     foreach (ActionState currentActionState in creatureStateMachine.ActionStates)
     {
         if (requestedActionStateType.GetType() == currentActionState.GetType())
         {
             return(currentActionState);
         }
     }
     Debug.LogError("No ActionState on Creature called: " + requestedActionStateType.GetType().ToString());
     return(creatureStateMachine.DefaultState);
 }
Example #2
0
    public void SetActionState(ActionState state)
    {
        if (_currentActionState != null)
        {
            _currentActionState.OnStateExit(state);
        }
        ActionState exitingState = _currentActionState;

        _currentActionState = state;
        gameObject.name     = "Jugador - " + state.GetType().Name;

        if (_currentActionState != null)
        {
            _currentActionState.OnStateEnter(exitingState);
        }
    }
Example #3
0
    public void TriggerNext(ActionState requestedState)
    {
        // turn all ActionStates off - do all to confirm no defects
        foreach (ActionState actionState in ActionStates)
        {
            actionState.enabled = false;
        }

        foreach (ActionState actionState in ActionStates)
        {
            // catch current state
            if (actionState.GetType() == requestedState.GetType())
            {
                EnterState(actionState);
            }
        }
    }
 public void Save(String PropertyName, ActionState Value)
 {
     _GameSaver.CreateChildElement(_Element, PropertyName, Value.GetType(), Value.ToString());
 }