Пример #1
0
        private float CalcTimeToComplete(Agent agent)
        {
            // Add in GoTo Mapping if needed
            float       goToTime    = 0f;
            DeciderType deciderType = agent.decider.DeciderType();

            if (deciderType.RequiresGoToMapping(agent, this))
            {
                Mapping goToMapping = deciderType.CreateGoToMapping(this);
                goToTime    = goToMapping.mappingType.actionType.behaviorType.EstimatedTimeToComplete(agent, goToMapping);
                goToMapping = null;
            }
            return(goToTime + mappingType.actionType.behaviorType.EstimatedTimeToComplete(agent, this));
        }
Пример #2
0
 private void ResetDeciderType()
 {
     deciderType = agentType.defaultDeciderType;
     foreach (AgentTypeOverride agentTypeOverride in entityTypeOverrides)
     {
         if (agentTypeOverride.defaultDeciderType != null)
         {
             deciderType = agentTypeOverride.defaultDeciderType;
         }
     }
     if (deciderType == null)
     {
         Debug.LogError(name + ": AgentType = " + agentType.name + " is missing a defaultDeciderType.  Please fix.");
         return;
     }
     decider = new Decider(this, deciderType);
 }
Пример #3
0
        public Decider(Agent agent, DeciderType deciderType)
        {
            currentPlans          = null;
            previousPlans         = null;
            CurrentPlanIndex      = -1;
            CurrentMapping        = null;
            PreviousMapping       = null;
            CurrentDriveType      = null;
            isActing              = false;
            previouslyInterrupted = false;
            lastReplanTime        = 0;
            currentPlanUtility    = -1000;
            animationEventCount   = 0;

            this.agent       = agent;
            this.deciderType = deciderType;
            if (deciderType != null)
            {
                deciderType.Setup(agent);
            }
        }