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);
 }
        public static void NavigateToMountableLoc(
            NPCHumanContext c,
            HumanNavigateToOperator.OperatorType mountableType)
        {
            if (mountableType == HumanNavigateToOperator.OperatorType.MountableChair && ConVar.AI.npc_ignore_chairs)
            {
                return;
            }
            BaseMountable chairTarget = (BaseMountable)c.ChairTarget;

            if (Object.op_Equality((Object)chairTarget, (Object)null))
            {
                return;
            }
            Vector3    position = ((Component)chairTarget).get_transform().get_position();
            NavMeshHit navMeshHit;

            if (NavMesh.SamplePosition(position, ref navMeshHit, 10f, c.Human.NavAgent.get_areaMask()))
            {
                position = ((NavMeshHit) ref navMeshHit).get_position();
            }
            if (Mathf.Approximately(((Vector3) ref position).get_sqrMagnitude(), 0.0f))
            {
                return;
            }
            HumanNavigateToOperator.MakeUnstuck(c);
            c.Human.StoppingDistance = 0.05f;
            c.Human.Destination      = position;
            c.Human.SetTargetPathStatus(0.05f);
        }
        public static void NavigateToPatrolLoc(NPCHumanContext c)
        {
            if (Object.op_Equality((Object)c.AiLocationManager, (Object)null) || !IsHumanRoamReady.Evaluate(c) || !c.AIAgent.IsNavRunning())
            {
                return;
            }
            PathInterestNode patrolPointInRange = c.AiLocationManager.GetRandomPatrolPointInRange(c.Position, c.AIAgent.GetStats.MinRoamRange, c.AIAgent.GetStats.MaxRoamRange, c.CurrentPatrolPoint);

            if (Object.op_Inequality((Object)patrolPointInRange, (Object)null))
            {
                Vector3 position = ((Component)patrolPointInRange).get_transform().get_position();
                if ((double)((Vector3) ref position).get_sqrMagnitude() > 0.0)
                {
                    HumanNavigateToOperator.MakeUnstuck(c);
                    c.Human.Destination = ((Component)patrolPointInRange).get_transform().get_position();
                    c.Human.SetTargetPathStatus(0.05f);
                    c.CurrentPatrolPoint = patrolPointInRange;
                }
            }
            HumanNavigateToOperator.UpdateRoamTime(c);
            if (c.Human.OnChatter == null)
            {
                return;
            }
            c.Human.OnChatter();
        }
        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 NavigateToMountableLoc(NPCHumanContext c, HumanNavigateToOperator.OperatorType mountableType)
        {
            NavMeshHit navMeshHit;

            if (mountableType == HumanNavigateToOperator.OperatorType.MountableChair && ConVar.AI.npc_ignore_chairs)
            {
                return;
            }
            BaseMountable chairTarget = c.ChairTarget;

            if (chairTarget == null)
            {
                return;
            }
            Vector3 vector3 = chairTarget.transform.position;

            if (NavMesh.SamplePosition(vector3, out navMeshHit, 10f, c.Human.NavAgent.areaMask))
            {
                vector3 = navMeshHit.position;
            }
            if (Mathf.Approximately(vector3.sqrMagnitude, 0f))
            {
                return;
            }
            HumanNavigateToOperator.MakeUnstuck(c);
            c.Human.StoppingDistance = 0.05f;
            c.Human.Destination      = vector3;
            c.Human.SetTargetPathStatus(0.05f);
        }
 public static void FleeHurtDir(NPCHumanContext c)
 {
     if (c.AIAgent.IsNavRunning() && HumanNavigateToOperator.NavigateInDirOfBestSample(c, NavPointSampler.SampleCount.Eight, 4f, NavPointSampler.SampleFeatures.RetreatFromDirection, c.AIAgent.GetStats.MinFleeRange, c.AIAgent.GetStats.MaxFleeRange))
     {
         c.SetFact(NPCPlayerApex.Facts.IsFleeing, 1, true, true);
     }
 }
        public static void NavigateToEnemy(NPCHumanContext c)
        {
            if (c.GetFact(NPCPlayerApex.Facts.HasEnemy) <= (byte)0 || !c.AIAgent.IsNavRunning())
            {
                return;
            }
            if (c.GetFact(NPCPlayerApex.Facts.HasLineOfSight) > (byte)0)
            {
                Vector3 enemyPosition = c.EnemyPosition;
                if ((double)((Vector3) ref enemyPosition).get_sqrMagnitude() > 0.0)
                {
                    HumanNavigateToOperator.MakeUnstuck(c);
                    c.Human.StoppingDistance = 1.5f;
                    c.Human.Destination      = c.EnemyPosition;
                    goto label_6;
                }
            }
            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)
            {
                HumanNavigateToOperator.MakeUnstuck(c);
                c.Human.StoppingDistance = 1.5f;
                c.Human.Destination      = info.Position;
            }
label_6:
            c.Human.SetTargetPathStatus(0.05f);
        }
 public static void Sidestep(NPCHumanContext c)
 {
     if (c.AIAgent.IsNavRunning())
     {
         c.Human.StoppingDistance = 0.1f;
         if (HumanNavigateToOperator.NavigateInDirOfBestSample(c, NavPointSampler.SampleCount.Eight, 4f, NavPointSampler.SampleFeatures.FlankTarget, 2f, 5f) && c.AIAgent.GetFact(NPCPlayerApex.Facts.IsInCover) == 1)
         {
             c.AIAgent.SetFact(NPCPlayerApex.Facts.SidesteppedOutOfCover, 1, true, true);
         }
     }
 }
 public static void NavigateToRandomLoc(NPCHumanContext c)
 {
     if (IsHumanRoamReady.Evaluate(c) && c.AIAgent.IsNavRunning() && HumanNavigateToOperator.NavigateInDirOfBestSample(c, NavPointSampler.SampleCount.Eight, 4f, NavPointSampler.SampleFeatures.DiscourageSharpTurns, c.AIAgent.GetStats.MinRoamRange, c.AIAgent.GetStats.MaxRoamRange))
     {
         HumanNavigateToOperator.UpdateRoamTime(c);
         if (c.Human.OnChatter != null)
         {
             c.Human.OnChatter();
         }
     }
 }
 public static void NavigateToSpawnLoc(NPCHumanContext c)
 {
     if (IsHumanRoamReady.Evaluate(c) && c.AIAgent.IsNavRunning() && c.Human.SpawnPosition.sqrMagnitude > 0f)
     {
         HumanNavigateToOperator.MakeUnstuck(c);
         c.Human.StoppingDistance = 0.1f;
         c.Human.Destination      = c.Human.SpawnPosition;
         c.Human.SetTargetPathStatus(0.05f);
         HumanNavigateToOperator.UpdateRoamTime(c);
     }
 }
 public static void NavigateToHideout(NPCHumanContext c)
 {
     if (c.EnemyHideoutGuess != null && c.AIAgent.IsNavRunning() && c.EnemyHideoutGuess.Position.sqrMagnitude > 0f)
     {
         HumanNavigateToOperator.MakeUnstuck(c);
         c.Human.StoppingDistance = 1f;
         c.Human.Destination      = c.EnemyHideoutGuess.Position;
         c.Human.SetTargetPathStatus(0.05f);
     }
     HumanNavigateToOperator.UpdateRoamTime(c);
 }
 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;
     }
 }
 public static void PathToCover(NPCHumanContext c, Vector3 coverPosition)
 {
     if (coverPosition.sqrMagnitude > 0f)
     {
         HumanNavigateToOperator.MakeUnstuck(c);
         c.AIAgent.GetNavAgent.destination = coverPosition;
         c.Human.SetTargetPathStatus(0.05f);
         c.SetFact(NPCPlayerApex.Facts.IsMovingToCover, 1, true, true);
         if (c.Human.OnTakeCover != null)
         {
             c.Human.OnTakeCover();
         }
     }
 }
 public static void NavigateToHideout(NPCHumanContext c)
 {
     if (c.EnemyHideoutGuess != null && c.AIAgent.IsNavRunning())
     {
         Vector3 position = c.EnemyHideoutGuess.Position;
         if ((double)((Vector3) ref position).get_sqrMagnitude() > 0.0)
         {
             HumanNavigateToOperator.MakeUnstuck(c);
             c.Human.StoppingDistance = 1f;
             c.Human.Destination      = c.EnemyHideoutGuess.Position;
             c.Human.SetTargetPathStatus(0.05f);
         }
     }
     HumanNavigateToOperator.UpdateRoamTime(c);
 }
        private static bool NavigateInDirOfBestSample(NPCHumanContext c, NavPointSampler.SampleCount sampleCount, float radius, NavPointSampler.SampleFeatures features, float minRange, float maxRange)
        {
            bool flag;
            List <NavPointSample> navPointSamples = c.AIAgent.RequestNavPointSamplesInCircle(sampleCount, radius, features);

            if (navPointSamples == null)
            {
                return(false);
            }
            List <NavPointSample> .Enumerator enumerator = navPointSamples.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    Vector3 position = (enumerator.Current.Position - c.Position).normalized;
                    Vector3 vector3  = c.Position + (position * minRange) + (position * ((maxRange - minRange) * UnityEngine.Random.@value));
                    if (c.AIAgent.AttackTarget != null && !NavPointSampler.IsValidPointDirectness(vector3, c.Position, c.EnemyPosition))
                    {
                        continue;
                    }
                    NavPointSampler.SampleScoreParams sampleScoreParam = new NavPointSampler.SampleScoreParams()
                    {
                        WaterMaxDepth = c.AIAgent.GetStats.MaxWaterDepth,
                        Agent         = c.AIAgent,
                        Features      = features
                    };
                    NavPointSample navPointSample = NavPointSampler.SamplePoint(vector3, sampleScoreParam);
                    if (Mathf.Approximately(navPointSample.Score, 0f) || Mathf.Approximately(navPointSample.Position.sqrMagnitude, 0f))
                    {
                        continue;
                    }
                    HumanNavigateToOperator.MakeUnstuck(c);
                    vector3 = navPointSample.Position;
                    c.AIAgent.GetNavAgent.destination = vector3;
                    c.Human.SetTargetPathStatus(0.05f);
                    c.AIAgent.SetFact(NPCPlayerApex.Facts.IsMoving, 1, true, false);
                    flag = true;
                    return(flag);
                }
                return(false);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(flag);
        }
        public static void NavigateToSpawnLoc(NPCHumanContext c)
        {
            if (!IsHumanRoamReady.Evaluate(c) || !c.AIAgent.IsNavRunning())
            {
                return;
            }
            Vector3 spawnPosition = c.Human.SpawnPosition;

            if ((double)((Vector3) ref spawnPosition).get_sqrMagnitude() <= 0.0)
            {
                return;
            }
            HumanNavigateToOperator.MakeUnstuck(c);
            c.Human.StoppingDistance = 0.1f;
            c.Human.Destination      = c.Human.SpawnPosition;
            c.Human.SetTargetPathStatus(0.05f);
            HumanNavigateToOperator.UpdateRoamTime(c);
        }
        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);
                }
            }
 public static void NavigateToPatrolLoc(NPCHumanContext c)
 {
     if (c.AiLocationManager == null)
     {
         return;
     }
     if (IsHumanRoamReady.Evaluate(c) && c.AIAgent.IsNavRunning())
     {
         PathInterestNode randomPatrolPointInRange = c.AiLocationManager.GetRandomPatrolPointInRange(c.Position, c.AIAgent.GetStats.MinRoamRange, c.AIAgent.GetStats.MaxRoamRange, c.CurrentPatrolPoint);
         if (randomPatrolPointInRange != null && randomPatrolPointInRange.transform.position.sqrMagnitude > 0f)
         {
             HumanNavigateToOperator.MakeUnstuck(c);
             c.Human.Destination = randomPatrolPointInRange.transform.position;
             c.Human.SetTargetPathStatus(0.05f);
             c.CurrentPatrolPoint = randomPatrolPointInRange;
         }
         HumanNavigateToOperator.UpdateRoamTime(c);
         if (c.Human.OnChatter != null)
         {
             c.Human.OnChatter();
         }
     }
 }
 public static void NavigateToEnemy(NPCHumanContext c)
 {
     if (c.GetFact(NPCPlayerApex.Facts.HasEnemy) > 0 && c.AIAgent.IsNavRunning())
     {
         if (c.GetFact(NPCPlayerApex.Facts.HasLineOfSight) <= 0 || c.EnemyPosition.sqrMagnitude <= 0f)
         {
             Memory.SeenInfo info = c.Memory.GetInfo(c.AIAgent.AttackTarget);
             if (info.Entity != null && info.Position.sqrMagnitude > 0f)
             {
                 HumanNavigateToOperator.MakeUnstuck(c);
                 c.Human.StoppingDistance = 1.5f;
                 c.Human.Destination      = info.Position;
             }
         }
         else
         {
             HumanNavigateToOperator.MakeUnstuck(c);
             c.Human.StoppingDistance = 1.5f;
             c.Human.Destination      = c.EnemyPosition;
         }
         c.Human.SetTargetPathStatus(0.05f);
     }
 }
        public static void NavigateToCover(NPCHumanContext c, HumanNavigateToOperator.TakeCoverIntention intention)
        {
            if (!c.AIAgent.IsNavRunning())
            {
                return;
            }
            c.Human.TimeLastMovedToCover = UnityEngine.Time.realtimeSinceStartup;
            switch (intention)
            {
            case HumanNavigateToOperator.TakeCoverIntention.Advance:
            {
                if (c.CoverSet.Advance.ReservedCoverPoint != null)
                {
                    HumanNavigateToOperator.PathToCover(c, c.CoverSet.Advance.ReservedCoverPoint.Position);
                    return;
                }
                if (c.CoverSet.Closest.ReservedCoverPoint == null)
                {
                    break;
                }
                HumanNavigateToOperator.PathToCover(c, c.CoverSet.Closest.ReservedCoverPoint.Position);
                return;
            }

            case HumanNavigateToOperator.TakeCoverIntention.Flank:
            {
                if (c.CoverSet.Flank.ReservedCoverPoint != null)
                {
                    HumanNavigateToOperator.PathToCover(c, c.CoverSet.Flank.ReservedCoverPoint.Position);
                    c.SetFact(NPCPlayerApex.Facts.IsRetreatingToCover, 1, true, true);
                    return;
                }
                if (c.CoverSet.Closest.ReservedCoverPoint == null)
                {
                    break;
                }
                HumanNavigateToOperator.PathToCover(c, c.CoverSet.Closest.ReservedCoverPoint.Position);
                c.SetFact(NPCPlayerApex.Facts.IsRetreatingToCover, 1, true, true);
                return;
            }

            case HumanNavigateToOperator.TakeCoverIntention.Retreat:
            {
                if (c.CoverSet.Retreat.ReservedCoverPoint != null)
                {
                    HumanNavigateToOperator.PathToCover(c, c.CoverSet.Retreat.ReservedCoverPoint.Position);
                    c.SetFact(NPCPlayerApex.Facts.IsRetreatingToCover, 1, true, true);
                    return;
                }
                if (c.CoverSet.Closest.ReservedCoverPoint == null)
                {
                    break;
                }
                HumanNavigateToOperator.PathToCover(c, c.CoverSet.Closest.ReservedCoverPoint.Position);
                c.SetFact(NPCPlayerApex.Facts.IsRetreatingToCover, 1, true, true);
                return;
            }

            case HumanNavigateToOperator.TakeCoverIntention.Closest:
            {
                if (c.CoverSet.Closest.ReservedCoverPoint == null)
                {
                    break;
                }
                HumanNavigateToOperator.PathToCover(c, c.CoverSet.Closest.ReservedCoverPoint.Position);
                break;
            }

            default:
            {
                goto case HumanNavigateToOperator.TakeCoverIntention.Closest;
            }
            }
        }
        public override void DoExecute(BaseContext c)
        {
            NPCHumanContext c1 = c as NPCHumanContext;

            if (c.GetFact(NPCPlayerApex.Facts.CanNotMove) == (byte)1 || c1 != null && c1.Human.NeverMove)
            {
                c.AIAgent.StopMoving();
                c1?.Human.SetFact(NPCPlayerApex.Facts.PathToTargetStatus, (byte)2, true, true);
            }
            else
            {
                c.AIAgent.SetFact(NPCPlayerApex.Facts.IsRetreatingToCover, (byte)0, true, true);
                c.AIAgent.SetFact(NPCPlayerApex.Facts.SidesteppedOutOfCover, (byte)0, true, true);
                if ((double)Time.get_time() - (double)c1.LastNavigationTime < 1.0)
                {
                    return;
                }
                c1.LastNavigationTime = Time.get_time();
                if (c1.Human.NavAgent.get_pathPending())
                {
                    return;
                }
                switch (this.Operator)
                {
                case HumanNavigateToOperator.OperatorType.EnemyLoc:
                    HumanNavigateToOperator.NavigateToEnemy(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.RandomLoc:
                    HumanNavigateToOperator.NavigateToRandomLoc(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.SpawnLoc:
                    HumanNavigateToOperator.NavigateToSpawnLoc(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.FleeEnemy:
                    HumanNavigateToOperator.FleeEnemy(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.FleeHurtDir:
                    HumanNavigateToOperator.FleeHurtDir(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.RetreatCover:
                    HumanNavigateToOperator.NavigateToCover(c1, HumanNavigateToOperator.TakeCoverIntention.Retreat);
                    break;

                case HumanNavigateToOperator.OperatorType.FlankCover:
                    HumanNavigateToOperator.NavigateToCover(c1, HumanNavigateToOperator.TakeCoverIntention.Flank);
                    break;

                case HumanNavigateToOperator.OperatorType.AdvanceCover:
                    HumanNavigateToOperator.NavigateToCover(c1, HumanNavigateToOperator.TakeCoverIntention.Advance);
                    break;

                case HumanNavigateToOperator.OperatorType.FleeExplosive:
                    HumanNavigateToOperator.FleeExplosive(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.Sidestep:
                    HumanNavigateToOperator.Sidestep(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.ClosestCover:
                    HumanNavigateToOperator.NavigateToCover(c1, HumanNavigateToOperator.TakeCoverIntention.Closest);
                    break;

                case HumanNavigateToOperator.OperatorType.PatrolLoc:
                    HumanNavigateToOperator.NavigateToPatrolLoc(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.MountableChair:
                    HumanNavigateToOperator.NavigateToMountableLoc(c1, this.Operator);
                    break;

                case HumanNavigateToOperator.OperatorType.WaypointLoc:
                    HumanNavigateToOperator.NavigateToWaypointLoc(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.LastEnemyLoc:
                    HumanNavigateToOperator.NavigateToLastEnemy(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.HideoutLoc:
                    HumanNavigateToOperator.NavigateToHideout(c1);
                    break;
                }
            }
        }
        public override void DoExecute(BaseContext c)
        {
            NPCHumanContext nPCHumanContext = c as NPCHumanContext;

            if (c.GetFact(NPCPlayerApex.Facts.CanNotMove) == 1 || nPCHumanContext != null && nPCHumanContext.Human.NeverMove)
            {
                c.AIAgent.StopMoving();
                if (nPCHumanContext != null)
                {
                    nPCHumanContext.Human.SetFact(NPCPlayerApex.Facts.PathToTargetStatus, 2, true, true);
                }
                return;
            }
            c.AIAgent.SetFact(NPCPlayerApex.Facts.IsRetreatingToCover, 0, true, true);
            c.AIAgent.SetFact(NPCPlayerApex.Facts.SidesteppedOutOfCover, 0, true, true);
            if (UnityEngine.Time.time - nPCHumanContext.LastNavigationTime < 1f)
            {
                return;
            }
            nPCHumanContext.LastNavigationTime = UnityEngine.Time.time;
            if (nPCHumanContext.Human.NavAgent.pathPending)
            {
                return;
            }
            switch (this.Operator)
            {
            case HumanNavigateToOperator.OperatorType.EnemyLoc:
            {
                HumanNavigateToOperator.NavigateToEnemy(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.RandomLoc:
            {
                HumanNavigateToOperator.NavigateToRandomLoc(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.SpawnLoc:
            {
                HumanNavigateToOperator.NavigateToSpawnLoc(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.FleeEnemy:
            {
                HumanNavigateToOperator.FleeEnemy(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.FleeHurtDir:
            {
                HumanNavigateToOperator.FleeHurtDir(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.RetreatCover:
            {
                HumanNavigateToOperator.NavigateToCover(nPCHumanContext, HumanNavigateToOperator.TakeCoverIntention.Retreat);
                return;
            }

            case HumanNavigateToOperator.OperatorType.FlankCover:
            {
                HumanNavigateToOperator.NavigateToCover(nPCHumanContext, HumanNavigateToOperator.TakeCoverIntention.Flank);
                return;
            }

            case HumanNavigateToOperator.OperatorType.AdvanceCover:
            {
                HumanNavigateToOperator.NavigateToCover(nPCHumanContext, HumanNavigateToOperator.TakeCoverIntention.Advance);
                return;
            }

            case HumanNavigateToOperator.OperatorType.FleeExplosive:
            {
                HumanNavigateToOperator.FleeExplosive(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.Sidestep:
            {
                HumanNavigateToOperator.Sidestep(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.ClosestCover:
            {
                HumanNavigateToOperator.NavigateToCover(nPCHumanContext, HumanNavigateToOperator.TakeCoverIntention.Closest);
                return;
            }

            case HumanNavigateToOperator.OperatorType.PatrolLoc:
            {
                HumanNavigateToOperator.NavigateToPatrolLoc(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.MountableChair:
            {
                HumanNavigateToOperator.NavigateToMountableLoc(nPCHumanContext, this.Operator);
                return;
            }

            case HumanNavigateToOperator.OperatorType.WaypointLoc:
            {
                HumanNavigateToOperator.NavigateToWaypointLoc(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.LastEnemyLoc:
            {
                HumanNavigateToOperator.NavigateToLastEnemy(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.HideoutLoc:
            {
                HumanNavigateToOperator.NavigateToHideout(nPCHumanContext);
                return;
            }

            default:
            {
                return;
            }
            }
        }