예제 #1
0
        public override void SetContext(Agent agent, Behavior.Context behaviorContext)
        {
            DriveType driveType   = null;
            Agent     targetAgent = null;

            if (useTargetsDriveLevel)
            {
                if (behaviorContext.target == null || behaviorContext.target.GetComponent <Agent>() == null)
                {
                    Debug.LogError("WaitForDriveBehavior using targets drive is missing target or target is not an Agent.");
                }
                else
                {
                    targetAgent = behaviorContext.target.GetComponent <Agent>();
                    driveType   = (DriveType)agent.decider.CurrentMapping.mappingType.inputConditions[0].levelType;
                }
            }
            else
            {
                targetAgent = agent;
                driveType   = agent.decider.CurrentDriveType;
            }

            if (!agentsContexts.TryGetValue(agent, out Context context))
            {
                context = new Context();
                agentsContexts[agent] = context;
            }

            context.attributeSelectors = behaviorContext.attributeSelectors;
            context.driveTypeToWaitFor = driveType;
            context.targetAgent        = targetAgent;
        }
예제 #2
0
파일: WaitBT.cs 프로젝트: ming81/TotalAI
 public override void SetContext(Agent agent, Behavior.Context behaviorContext)
 {
     if (!agentsContexts.TryGetValue(agent, out Context context))
     {
         context = new Context();
         agentsContexts[agent] = context;
     }
 }
예제 #3
0
 public override void SetContext(Agent agent, Behavior.Context behaviorContext)
 {
     if (!agentsContexts.TryGetValue(agent, out Context context))
     {
         context = new Context();
         agentsContexts[agent] = context;
     }
     context.attributeSelectors = behaviorContext.attributeSelectors;
     context.target             = behaviorContext.target;
 }
예제 #4
0
파일: WorkOnBT.cs 프로젝트: ming81/TotalAI
        public override void SetContext(Agent agent, Behavior.Context behaviorContext)
        {
            if (!agentsContexts.TryGetValue(agent, out Context context))
            {
                context = new Context();
                agentsContexts[agent] = context;
            }

            context.currentSpeed       = behaviorContext.attributeSelectors[0].GetFloatValue(agent, agent.decider.CurrentMapping);
            context.target             = behaviorContext.target;
            context.attributeSelectors = behaviorContext.attributeSelectors;
        }
예제 #5
0
        public override void SetContext(Agent agent, Behavior.Context behaviorContext)
        {
            if (!agentsContexts.TryGetValue(agent, out Context context))
            {
                context = new Context();
                agentsContexts[agent] = context;
            }
            Selector attributeSelector = behaviorContext.attributeSelectors[0];

            context.target             = behaviorContext.target;
            context.attributeSelectors = behaviorContext.attributeSelectors;
            context.movementSpeedAT    = (MinMaxFloatAT)behaviorContext.attributeSelectors[0].attributeType;
            context.currentSpeed       = attributeSelector.GetFloatValue(agent, agent.decider.CurrentMapping);
        }
예제 #6
0
파일: FleeBT.cs 프로젝트: ming81/TotalAI
        public override void SetContext(Agent agent, Behavior.Context behaviorContext)
        {
            if (!agentsContexts.TryGetValue(agent, out Context context))
            {
                context = new Context();
                agentsContexts[agent] = context;
            }
            Selector valueSelector = behaviorContext.attributeSelectors[0];

            context.attributeSelectors = behaviorContext.attributeSelectors;
            context.currentSpeed       = valueSelector.GetFloatValue(agent, agent.decider.CurrentMapping);
            context.lastVelocity       = agent.movementType.VelocityMagnitude(agent);
            context.movementSpeedAT    = (MinMaxFloatAT)valueSelector.attributeType;
            //context.energyAT = (MinMaxFloatAT)behaviorContext.attributeSelectors[1].attributeType;
        }
예제 #7
0
파일: ExploreBT.cs 프로젝트: ming81/TotalAI
        public override void SetContext(Agent agent, Behavior.Context behaviorContext)
        {
            if (!agentsContexts.TryGetValue(agent, out Context context))
            {
                context = new Context();
                agentsContexts[agent] = context;
            }

            Selector valueSelector = behaviorContext.attributeSelectors[0];

            context.currentSpeed       = valueSelector.GetFloatValue(agent, agent.decider.CurrentMapping);
            context.targetPosition     = Vector3.positiveInfinity;
            context.attributeSelectors = behaviorContext.attributeSelectors;
            context.movementSpeedAT    = (MinMaxFloatAT)valueSelector.attributeType;
            context.energyAT           = (MinMaxFloatAT)behaviorContext.attributeSelectors[1].attributeType;
        }
예제 #8
0
        public override void SetContext(Agent agent, Behavior.Context behaviorContext)
        {
            if (!agentsContexts.TryGetValue(agent, out Context context))
            {
                context = new Context();
                agentsContexts[agent] = context;
            }
            context.attributeSelectors = behaviorContext.attributeSelectors;
            context.agentEvent         = (AgentEvent)behaviorContext.target;
            context.startTime          = Time.time;
            context.startedMoving      = false;
            context.targetPosition     = Vector3.positiveInfinity;

            context.movementSpeed = context.attributeSelectors[0].GetFloatValue(agent, agent.decider.CurrentMapping);
            context.boolParamName = context.attributeSelectors[1].GetEnumValue <string>(agent, agent.decider.CurrentMapping);
        }
예제 #9
0
 public override void SetContext(Agent agent, Behavior.Context behaviorContext)
 {
 }
예제 #10
0
 public abstract void SetContext(Agent agent, Behavior.Context behaviorContext);