void TouchingGroundChecker() { //raylength = myCapsule.height / 2 + 0.450f; //commented out because well, in case we want to change that number. in the inespector Ray groundCheckingRay = new Ray(transform.position, Vector3.down); RaycastHit whatWasHit = new RaycastHit(); Physics.Raycast(groundCheckingRay, out whatWasHit, raylength); Debug.DrawRay(transform.position, Vector3.down * (raylength)); if (whatWasHit.collider != null) { if (whatWasHit.collider.tag == "Ground") { PlayerJumpBehaviour.playerJumpBehaviour.jumpForce = initalJumpForce; PlayerJumpBehaviour.playerJumpBehaviour.jumpsCounter = 0; groundTouchStatus = groundTouchingStatuses.TouchingGround; } } else if (whatWasHit.collider == null) { //Debug.LogWarning("Not Touching Ground"); groundTouchStatus = groundTouchingStatuses.NotTouchingGround; } }
// Use this for initialization void Start() { initalJumpForce = PlayerJumpBehaviour.playerJumpBehaviour.jumpForce; resetRunningTimer = runningTimer; myCapsule = GetComponent <CapsuleCollider>(); groundTouchStatus = new groundTouchingStatuses(); groundTouchStatus = groundTouchingStatuses.TouchingGround; hittingRoadBlock = new HittingRoadBlock(); hittingRoadBlock = HittingRoadBlock.NotHittingBlock; }
public void JumpUp() { foreach (KeyCode item in JumpKeys) { if (Input.GetKeyDown(item) || CrossPlatformInputManager.GetButtonDown("myJump")) { PlayerJumpBehaviour.playerJumpBehaviour.JumpCalculations(); groundTouchStatus = groundTouchingStatuses.NotTouchingGround; break; } } }