public static void NavigateToLastEnemy(NPCHumanContext c)
        {
            NavMeshHit navMeshHit;

            if (c.AIAgent.AttackTarget != null && c.AIAgent.IsNavRunning())
            {
                Memory.SeenInfo info = c.Memory.GetInfo(c.AIAgent.AttackTarget);
                if (info.Entity != null && info.Position.sqrMagnitude > 0f)
                {
                    BasePlayer player = c.AIAgent.AttackTarget.ToPlayer();
                    if (player != null && (player.IsAdmin || player.IsDeveloper) && player.IsFlying)
                    {
                        SetHumanSpeed.Set(c, NPCPlayerApex.SpeedEnum.StandStill);
                        return;
                    }
                    if (!NavMesh.SamplePosition(info.Position, out navMeshHit, 1f, c.AIAgent.GetNavAgent.areaMask))
                    {
                        SetHumanSpeed.Set(c, NPCPlayerApex.SpeedEnum.StandStill);
                        return;
                    }
                    HumanNavigateToOperator.MakeUnstuck(c);
                    c.Human.StoppingDistance = 1f;
                    c.Human.Destination      = navMeshHit.position;
                    c.Human.SetTargetPathStatus(0.05f);
                }
            }
            HumanNavigateToOperator.UpdateRoamTime(c);
        }
 public static void NavigateToLastEnemy(NPCHumanContext c)
 {
     if (Object.op_Inequality((Object)c.AIAgent.AttackTarget, (Object)null) && c.AIAgent.IsNavRunning())
     {
         Memory.SeenInfo info = c.Memory.GetInfo(c.AIAgent.AttackTarget);
         if (Object.op_Inequality((Object)info.Entity, (Object)null) && (double)((Vector3) ref info.Position).get_sqrMagnitude() > 0.0)
         {
             BasePlayer player = c.AIAgent.AttackTarget.ToPlayer();
             if (Object.op_Inequality((Object)player, (Object)null) && (player.IsAdmin || player.IsDeveloper) && player.IsFlying)
             {
                 SetHumanSpeed.Set((BaseContext)c, NPCPlayerApex.SpeedEnum.StandStill);
                 return;
             }
             NavMeshHit navMeshHit;
             if (!NavMesh.SamplePosition(info.Position, ref navMeshHit, 1f, c.AIAgent.GetNavAgent.get_areaMask()))
             {
                 SetHumanSpeed.Set((BaseContext)c, NPCPlayerApex.SpeedEnum.StandStill);
                 return;
             }
             HumanNavigateToOperator.MakeUnstuck(c);
             c.Human.StoppingDistance = 1f;
             c.Human.Destination      = ((NavMeshHit) ref navMeshHit).get_position();
             c.Human.SetTargetPathStatus(0.05f);
         }
     }
     HumanNavigateToOperator.UpdateRoamTime(c);
 }
Example #3
0
 public override void DoExecute(BaseContext c)
 {
     SetHumanSpeed.Set(c, this.value);
 }