Example #1
0
    protected virtual void TryPerformCurrentAction()
    {
        if (currentAction.Name == "Dance to Music")
        {
            GetComponentInChildren <IKControl>().isDancing = true;
        }

        // actions will be thrown away either when they are canceled/interrupted or qhen they are performed successfully
        if (currentAction.interrupted || currentAction.Perform())
        {
            GetComponentInChildren <IKControl>().isDancing = false;

            if (currentAction.interrupted)
            {
                currentAction.EndInterrupted();
            }
            currentAction = null;

            // select the next action in the queue immedieatly
            if (actionQueue.Count > 0)
            {
                Debug.Log(gameObject.name + ": Follow up with next action!");
                ActionTick();
            }
        }
    }