Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public override void Start(IGameInterface gameInterface)
        {
            if (currentActivity == null && (activityQueue == null || activityQueue.Count == 0))
            {
                this.HasFinished = true;
                return;
            }

            currentActivity = activityQueue.Dequeue();
            currentActivity.Start(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);
        }
Esempio n. 4
0
 public void Add(ActivityBase a)
 {
     this.Activities.Add(a);
 }
 public void PushActivity(ActivityBase activity)
 {
     activityQueue.Enqueue(activity);
 }
Esempio n. 6
0
 public void Add(ActivityBase a)
 {
     this.activityQueue.Enqueue(a);
 }