示例#1
0
 private void InitializeState(FWState newState)
 {
     _states.Add(newState);
     this.CurrentState     = newState;
     this.CurrentStateType = newState.NpcState;
     for (int i = 0; i < _states.Count; i++)
     {
         if (_states[i].NpcState == CurrentStateType)
         {
             CurrentState.CleanupOldState();
             CurrentState = _states[i];
             CurrentState.InitializeNewState();
             break;
         }
     }
 }
示例#2
0
    public void AddNewState(FWState newState)
    {
        if (!FWStateUtility.IsValidState(newState))
        {
            return;
        }
        if (_states.Count == 0) // if there are no states, add state as first
        {
            InitializeState(newState);
            return;
        }

        for (int i = 0; i < _states.Count; i++)
        {
            if (_states[i].NpcState == newState.NpcState)
            {
                Debug.LogError("The state being added already exists in the list");
                return;
            }
        }

        _states.Add(newState);
    }
示例#3
0
 public static bool IsValidState(FWState stateToCheck)
 {
     return(stateToCheck != null);
 }