private static void NavigateToWaypointLoc(NPCHumanContext c)
 {
     if (c.GetFact(NPCPlayerApex.Facts.HasWaypoints) > 0 && c.Human.IsNavRunning())
     {
         c.Human.StoppingDistance = 0.3f;
         WaypointSet.Waypoint item = c.Human.WaypointSet.Points[c.Human.CurrentWaypointIndex];
         bool    flag      = false;
         Vector3 transform = item.Transform.position;
         if ((c.Human.Destination - transform).sqrMagnitude > 0.01f)
         {
             HumanNavigateToOperator.MakeUnstuck(c);
             c.Human.Destination = transform;
             c.Human.SetTargetPathStatus(0.05f);
             flag = true;
         }
         float single = 0f;
         int   num    = c.Human.PeekNextWaypointIndex();
         if (c.Human.WaypointSet.Points.Count > num && Mathf.Approximately(c.Human.WaypointSet.Points[num].WaitTime, 0f))
         {
             single = 1f;
         }
         if ((c.Position - c.Human.Destination).sqrMagnitude > c.Human.SqrStoppingDistance + single)
         {
             c.Human.LookAtPoint = null;
             c.Human.LookAtEyes  = null;
             if (c.GetFact(NPCPlayerApex.Facts.IsMoving) != 0 || flag)
             {
                 c.SetFact(NPCPlayerApex.Facts.IsMovingTowardWaypoint, 1, true, true);
                 return;
             }
             c.Human.CurrentWaypointIndex = c.Human.GetNextWaypointIndex();
             c.SetFact(NPCPlayerApex.Facts.IsMovingTowardWaypoint, 0, true, true);
             return;
         }
         if (HumanNavigateToOperator.IsWaitingAtWaypoint(c, ref item))
         {
             if (!IsClosestPlayerWithinDistance.Test(c, 4f))
             {
                 c.Human.LookAtEyes = null;
                 c.Human.LookAtRandomPoint(5f);
             }
             else
             {
                 LookAtClosestPlayer.Do(c);
             }
             c.SetFact(NPCPlayerApex.Facts.IsMovingTowardWaypoint, 0, true, true);
             return;
         }
         c.Human.CurrentWaypointIndex = c.Human.GetNextWaypointIndex();
         c.Human.LookAtPoint          = null;
     }
 }
        private static void NavigateToWaypointLoc(NPCHumanContext c)
        {
            if (c.GetFact(NPCPlayerApex.Facts.HasWaypoints) <= (byte)0 || !c.Human.IsNavRunning())
            {
                return;
            }
            c.Human.StoppingDistance = 0.3f;
            WaypointSet.Waypoint point = c.Human.WaypointSet.Points[c.Human.CurrentWaypointIndex];
            bool    flag      = false;
            Vector3 position  = point.Transform.get_position();
            Vector3 vector3_1 = Vector3.op_Subtraction(c.Human.Destination, position);

            if ((double)((Vector3) ref vector3_1).get_sqrMagnitude() > 0.00999999977648258)
            {
                HumanNavigateToOperator.MakeUnstuck(c);
                c.Human.Destination = position;
                c.Human.SetTargetPathStatus(0.05f);
                flag = true;
            }
            float num   = 0.0f;
            int   index = c.Human.PeekNextWaypointIndex();

            if (c.Human.WaypointSet.Points.Count > index && Mathf.Approximately(c.Human.WaypointSet.Points[index].WaitTime, 0.0f))
            {
                num = 1f;
            }
            Vector3 vector3_2 = Vector3.op_Subtraction(c.Position, c.Human.Destination);

            if ((double)((Vector3) ref vector3_2).get_sqrMagnitude() > (double)c.Human.SqrStoppingDistance + (double)num)
            {
                c.Human.LookAtPoint = (Transform)null;
                c.Human.LookAtEyes  = (PlayerEyes)null;
                if (c.GetFact(NPCPlayerApex.Facts.IsMoving) == (byte)0 && !flag)
                {
                    c.Human.CurrentWaypointIndex = c.Human.GetNextWaypointIndex();
                    c.SetFact(NPCPlayerApex.Facts.IsMovingTowardWaypoint, (byte)0, true, true);
                }
                else
                {
                    c.SetFact(NPCPlayerApex.Facts.IsMovingTowardWaypoint, (byte)1, true, true);
                }
            }
 private static bool IsWaitingAtWaypoint(NPCHumanContext c, ref WaypointSet.Waypoint waypoint)
 {
     if (c.Human.IsWaitingAtWaypoint || waypoint.WaitTime <= 0f)
     {
         if (c.Human.IsWaitingAtWaypoint && UnityEngine.Time.time >= c.Human.WaypointDelayTime)
         {
             c.Human.IsWaitingAtWaypoint = false;
         }
         if (!c.Human.IsWaitingAtWaypoint)
         {
             return(false);
         }
     }
     else
     {
         c.Human.WaypointDelayTime   = UnityEngine.Time.time + waypoint.WaitTime;
         c.Human.IsWaitingAtWaypoint = true;
         c.SetFact(NPCPlayerApex.Facts.Speed, 0, true, true);
     }
     return(true);
 }