public void getLevelStateList(List <StateScript> levelList)
 {
     foreach (StateScript state in levelList)
     {
         stackStateList.Push(state);
     }
     currentState = stackStateList.Peek();
     currentState.atInit();
 }
 public void nextState()
 {
     if (stackStateList.Count != 0)
     {
         stackStateList.Pop();
         currentState.atEnd();
         currentState.enabled = false;
         if (stackStateList.Count != 0)
         {
             currentState = stackStateList.Peek();
             currentState.atInit();
         }
     }
 }