Beispiel #1
0
        private IEnumerator UpdateBehavior()
        {
            yield return(new WaitForSeconds(behaviorType.afterStartWaitTime));

            while (isRunning)
            {
                // Check to see if repeating OutputChanges need to run
                agent.decider.RunRepeatingOutputChanges();
                agent.decider.RunAfterGameMinutesOutputChanges();

                if (isWaiting && Time.time - startedWaitingAt > waitTime)
                {
                    isWaiting = false;
                }

                if (!isWaiting && behaviorType.IsFinished(agent))
                {
                    agent.historyType.RecordBehaviorLog(agent, HistoryType.BehaviorRunType.Finished, behaviorType);
                    isRunning = false;
                }
                else
                {
                    agent.historyType.RecordBehaviorLog(agent, HistoryType.BehaviorRunType.Updated, behaviorType);
                    behaviorType.UpdateBehavior(agent);

                    yield return(new WaitForSeconds(behaviorType.afterStartWaitTime));
                }
            }

            yield return(new WaitForSeconds(behaviorType.beforeFinishWaitTime));

            FinishBehavior();
        }