Пример #1
0
 public void SetCurrentAction(IAction newAction)
 {
     if (currentAction != null)
     {
         currentAction.Cancel();
     }
     currentAction = newAction;
     currentAction.Begin();
 }
Пример #2
0
    void Update()
    {
        MovePlayer();

        if (activeAction != null)
        {
            RunAction(activeAction);
        }

        if (activeAction == null && actions.Count > 0)
        {
            IAction nextAction = actions.Dequeue();
            activeAction = nextAction;
            activeAction.Begin();
        }
    }