Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
 public override void SetContext(Agent agent, Behavior.Context behaviorContext)
 {
     if (!agentsContexts.TryGetValue(agent, out Context context))
     {
         context = new Context();
         agentsContexts[agent] = context;
     }
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 9
0
 public override void SetContext(Agent agent, Behavior.Context behaviorContext)
 {
 }
Ejemplo n.º 10
0
 public abstract void SetContext(Agent agent, Behavior.Context behaviorContext);