コード例 #1
0
        public override void Update(/* inout */ SteeringBlender steering, Actor owner, IAgentStateManager agent)
        {
            if (agent.HasProperty(AgentPropertyName.ActiveOpponent))
            {
                ZombieCombatState zcs = new ZombieCombatState();
                agent.CurrentState = zcs;
                return;
            }
            else if (agent.TimeInState.Ticks >= mDurationTicks)
            {
                ZombieWaitState zws = new ZombieWaitState(8.0f);
                agent.CurrentState = zws;
                return;
            }

            BipedControllerComponent bcc = owner.GetComponent <BipedControllerComponent>(ActorComponent.ComponentType.Control);
            Vector3 displacementFromHome = BepuConverter.Convert(bcc.Controller.Body.Position) - steering.Target;

            displacementFromHome.Y = 0.0f;

            float tr = agent.GetProperty <float>(AgentPropertyName.TerritoryRadius);

            steering.Weights[(int)SteeringBlender.WeightType.Seek] = Math.Min(Math.Max(displacementFromHome.Length() - tr * 0.75f, 0.0f)
                                                                              / tr, 1.0f);
            steering.Weights[(int)SteeringBlender.WeightType.Wander] = 1.0f - steering.Weights[(int)SteeringBlender.WeightType.Seek];
        }
コード例 #2
0
 public override void Update(SteeringBlender steering, Actor owner, IAgentStateManager agent)
 {
     if (agent.TimeInState.Ticks >= mDurationTicks)
     {
         ZombieCombatState zcs = new ZombieCombatState();
         agent.CurrentState = zcs;
     }
 }
コード例 #3
0
 public override void Update(/* inout */ SteeringBlender steering, Actor owner, IAgentStateManager agent)
 {
     if (agent.HasProperty(AgentPropertyName.ActiveOpponent))
     {
         ZombieCombatState zcs = new ZombieCombatState();
         agent.CurrentState = zcs;
     }
     else if (agent.TimeInState.Ticks >= mDurationTicks)
     {
         ZombieTurnState zts = new ZombieTurnState();
         agent.CurrentState = zts;
     }
 }
コード例 #4
0
        public override void Update(/* inout */ SteeringBlender steering, Actor owner, IAgentStateManager agent)
        {
            steering.ForceScale = (float)(agent.TimeInState.Ticks) / (float)mDurationTicks;

            if (agent.HasProperty(AgentPropertyName.ActiveOpponent))
            {
                ZombieCombatState zcs = new ZombieCombatState();
                agent.CurrentState = zcs;
            }
            else if (agent.TimeInState.Ticks >= mDurationTicks)
            {
                ZombieWanderState zws = new ZombieWanderState(8.0f);
                agent.CurrentState = zws;
            }
        }