public override void DoExecute(BaseContext context) { NPCHumanContext nPCHumanContext = context as NPCHumanContext; if (nPCHumanContext != null) { LookAtClosestPlayer.Do(nPCHumanContext); } }
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; } }