Beispiel #1
0
    void Update()
    {
        if (currentActivity == null && activityQueue != null && activityQueue.Count > 0)
        {
            currentActivity = this.activityQueue.Dequeue();
            currentActivity.OnBeginning();
        }

        if (currentActivity == null)
        {
            if (destroySelf)
            {
                Destroy(this.gameObject);
            }
            return;
        }

        if (currentActivity.HasFinished())
        {
            currentActivity.OnFinished();
            currentActivity = null;
            return;
        }

        currentActivity.Update();
    }