public override void Update(IGameInterface gameInterface) { if (currentActivity == null && (activityQueue == null || activityQueue.Count == 0)) { this.HasFinished = true; return; } if (currentActivity == null || currentActivity.HasFinished) { if (currentActivity != null) { Debug.LogFormat("SequenceActivity: Finished activity. type={0}", currentActivity.GetType()); currentActivity = null; this.HasFinished = true; } if (activityQueue != null && activityQueue.Count > 0) { currentActivity = activityQueue.Dequeue(); Debug.LogFormat("SequenceActivity: Starting activity. type={0}", currentActivity.GetType()); currentActivity.Start(gameInterface); } return; } currentActivity.Update(gameInterface); }
public void Update() { if (currentActivity == null && (activityQueue == null || activityQueue.Count == 0)) { // Nothing to do now if (!isIdling) { isIdling = true; gameInterface.GetGameHandler().NotifyAI(); } return; } isIdling = false; if (currentActivity == null || currentActivity.HasFinished) { if (currentActivity != null) { Debug.LogFormat("ActivityManager: Finished activity. type={0}", currentActivity.GetType()); currentActivity = null; } if (activityQueue != null && activityQueue.Count > 0) { currentActivity = activityQueue.Dequeue(); Debug.LogFormat("ActivityManager: Starting activity. type={0}", currentActivity.GetType()); currentActivity.Start(gameInterface); } return; } currentActivity.Update(gameInterface); }