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 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); }