예제 #1
0
 public void AddState(UIStateBase state)
 {
     if (!StateDic.ContainsKey(state.GetType()))
     {
         StateDic.Add(state.GetType(), state);
     }
     if (StateDic.Values.Count == 1)
     {
         curState = state;
     }
 }
예제 #2
0
 public void DeleteState(UIStateBase state)
 {
     if (StateDic.ContainsKey(state.GetType()))
     {
         StateDic.Remove(state.GetType());
     }
     else
     {
         Debug.Log("The state you want to remove does not exist!");
     }
 }
예제 #3
0
 public void ChangeState(System.Type type)
 {
     curState.OnStateExit();
     if (StateDic.ContainsKey(type))
     {
         if (curState.GetType() == type)
         {
             curState.OnStateStart();
         }
         else
         {
             curState = StateDic[type];
             curState.OnStateStart();
         }
     }
     else
     {
         Debug.Log("The state you want to change does not exist!");
     }
 }