public void SmoothDamp(bool stopDestSelect = true) { if (isSelecting && destinationTarget == null) { return; } finalDestination = LocomoteDestinationFromFloor(destinationPosition); finalRotation = destinationRotation; totalDistanceToDestination = Vector3.Distance(m_charTransform.position, finalDestination); locomotionType = LocomotionType.SmoothDamp; lastJoystickAngle = 0f; ChangePlayerMovement(false, false); m_characterController.enabled = false; foreach (Rigidbody rb in m_rbs) { rb.isKinematic = false; } teleported = false; isTeleporting = true; if (stopDestSelect) { StopSelectDestination(); } }
public void Instant(bool stopDestSelect = true) { // If we're currently selecting, we'll grab the target position from destinationPosition if (isSelecting && destinationTarget == null) { return; } finalDestination = LocomoteDestinationFromFloor(destinationPosition); finalRotation = destinationRotation; totalDistanceToDestination = Vector3.Distance(m_charTransform.position, finalDestination); locomotionType = LocomotionType.Instant; lastJoystickAngle = 0f; ChangePlayerMovement(false, false); foreach (Rigidbody rb in m_rbs) { rb.isKinematic = false; } teleported = false; isTeleporting = true; if (stopDestSelect) { StopSelectDestination(); } }
public void ChangeLocomotion(LocomotionType locomotionType, bool save) { player.ChangeLocomotionType(locomotionType); if (save) { PlayerPrefs.SetInt("LocomotionSelection", locomotionType == LocomotionType.Teleport ? 0 : 1); } UpdateTeleportStatus(); }
public void StopLocomotion() { // m_screenFader.SetFadeLevel(0); m_screenFader.SetExplicitFade(0); velocity = Vector3.zero; teleported = true; isTeleporting = false; m_characterController.enabled = true; ResetPlayerMovement(); locomotionType = LocomotionType.None; }
public void ChangeLocomotionType(LocomotionType loc) { selectedLocomotion = loc; if (teleport == null) { teleport = GetComponent <PlayerTeleport>(); } toggleTeleport(selectedLocomotion == LocomotionType.Teleport); toggleSmoothLocomotion(selectedLocomotion == LocomotionType.SmoothLocomotion); }
public void TranslateLikeJoystick() { locomotionType = LocomotionType.TranslateLikeJoystick; lastJoystickAngle = 0f; ChangePlayerMovement(false, true); m_characterController.enabled = false; foreach (Rigidbody rb in m_rbs) { rb.isKinematic = false; } teleported = false; isTeleporting = true; }
public void ManualTranslateTarget(Vector3 dest, Quaternion rot) { finalDestination = LocomoteDestinationFromFloor(dest); finalRotation = rot; locomotionType = LocomotionType.TranslateTarget; lastJoystickAngle = 0f; ChangePlayerMovement(false, false); m_characterController.enabled = false; foreach (Rigidbody rb in m_rbs) { rb.isKinematic = false; } teleported = false; isTeleporting = true; }
public void ManualSmoothDamp(Vector3 dest, Quaternion rot) { finalDestination = LocomoteDestinationFromFloor(dest); finalRotation = rot; totalDistanceToDestination = Vector3.Distance(m_charTransform.position, finalDestination); locomotionType = LocomotionType.SmoothDamp; lastJoystickAngle = 0f; ChangePlayerMovement(false, false); m_characterController.enabled = false; foreach (Rigidbody rb in m_rbs) { rb.isKinematic = false; } teleported = false; isTeleporting = true; }
public void ChangeLocomotionType(LocomotionType loc) { // Make sure Smooth Locomotion is available if (smoothLocomotion == null) { smoothLocomotion = GetComponent <SmoothLocomotion>(); } selectedLocomotion = loc; if (teleport == null) { teleport = GetComponent <PlayerTeleport>(); } toggleTeleport(selectedLocomotion == LocomotionType.Teleport); toggleSmoothLocomotion(selectedLocomotion == LocomotionType.SmoothLocomotion); }
protected void Stop() { if (Agent.isOnNavMesh && Agent.enabled) { Agent.destination = Player.transform.position; } Locomotion.jump = false; Speed = 0; Direction = 0; motionType = LocomotionType.normal; Locomotion.ResetHoldTugAnimator(); Locomotion.ResetSpeedMultiples(); player.GetTugOfWar().RemoveJoint(); Player.GetComponent <Rigidbody>().velocity = Vector3.zero; Player.GetComponent <Animator>().rootPosition = Player.transform.position; isForcedGoTo = false; forceGoTo = Player.transform.position; }
public virtual void ForceGoTo(Vector3 position, Transform loockat) { if (isForcedGoTo) { return; } if (!Agent.isOnNavMesh && !Agent.enabled) { return; } Stop(); this.motionType = LocomotionType.strafe; isForcedGoTo = true; forceLoockat = loockat; forceGoTo = position; Agent.destination = forceGoTo; }
public void ChangeLocomotionType(LocomotionType loc) { selectedLocomotion = loc; if (teleport == null) { teleport = GetComponent <PlayerTeleport>(); } if (selectedLocomotion == LocomotionType.Teleport) { teleport.EnableTeleportation(); } else if (selectedLocomotion == LocomotionType.SmoothLocomotion) { teleport.DisableTeleportation(); } // Default to Disable All else { // Disable all teleport.DisableTeleportation(); } }
public SoccerAIGeneric(AIController owner, PlayerController controller) { this.owner = owner; this.player = controller; motionType = LocomotionType.normal; }