void ProcessMotion() { // Transforms to world space if (!animator.IsDead) { MoveVector = transform.TransformDirection(MoveVector); } else { MoveVector = new Vector3(0.0f, MoveVector.y, 0.0f); } // Normalizes the Vector if the magnitude if greater than 1 if (MoveVector.magnitude > 1) { MoveVector = Vector3.Normalize(MoveVector); } // Apply sliding if applicable ApplySlide(); MoveVector *= MoveSpeed(); // Reapply VerticalVelocity MoveVector.y MoveVector = new Vector3(MoveVector.x, VerticalVelocity, MoveVector.z); ApplyGravity(); controller.GetCharacterController().Move(MoveVector * Time.deltaTime); controller.cameraTarget.transform.position = controller.transform.position; }
void RollingLeft() { if (!IsRolling) { ActionState = CharacterActionState.NoAction; } else { Vector3 direction = -playerController.transform.right * playerController.GetRollSpeed() * Time.deltaTime * playerController.GetRollDistance(); playerController.GetCharacterController().Move(direction); } }