public void CheckPlayerControls() { // Require focus if (RequireGameFocus && Application.isEditor && !Application.isFocused) { return; } // Player Up / Down if (AllowUpDownControls) { if (PlayerUpAction != null && PlayerUpAction.action.ReadValue <float>() == 1) { player.ElevateCameraHeight = Mathf.Clamp(player.ElevateCameraHeight + Time.deltaTime, 0.2f, 5f); } else if (PlayerDownAction != null && PlayerDownAction.action.ReadValue <float>() == 1) { player.ElevateCameraHeight = Mathf.Clamp(player.ElevateCameraHeight - Time.deltaTime, 0.2f, 5f); } } // Force Forward Arrow if (ForceStraightTeleportRotation && playerTeleport != null && playerTeleport.ForceStraightArrow == false) { playerTeleport.ForceStraightArrow = true; } // Player Move Forward / Back, Snap Turn if (smoothLocomotion != null && smoothLocomotion.enabled == false) { // Manually allow player movement if the smooth locomotion component is disabled smoothLocomotion.CheckControllerReferences(); smoothLocomotion.UpdateInputs(); if (smoothLocomotion.ControllerType == PlayerControllerType.CharacterController) { smoothLocomotion.MoveCharacter(); } else if (smoothLocomotion.ControllerType == PlayerControllerType.Rigidbody) { smoothLocomotion.MoveRigidCharacter(); } } }
public void CheckPlayerControls() { // Player Up / Down if (Input.GetKey(PlayerUp)) { player.ElevateCameraHeight = Mathf.Clamp(player.ElevateCameraHeight + Time.deltaTime, 0.2f, 5f); } else if (Input.GetKey(PlayerDown)) { player.ElevateCameraHeight = Mathf.Clamp(player.ElevateCameraHeight - Time.deltaTime, 0.2f, 5f); } // Player Move Forward / Back, Snap Turn if (smoothLocomotion != null && smoothLocomotion.enabled == false) { // Manually allow player movement if the smooth locomotion component is disabled smoothLocomotion.UpdateInputs(); smoothLocomotion.MoveCharacter(); } }