void CheckForGlide() { if (Input.GetButton("Glide") && !grounded && glideTimer > 0) { playerState = MovmentState.glide; //Velocity.y = 0; } }
void checkForJump() { float jump = Input.GetAxisRaw("Vertical"); if (Input.GetButtonDown("Vertical") && jump > 0) { playerState = MovmentState.jump; Velocity.x = 0; } }
void checkIfGrounded() { if (transform.position.y <= 0) { transform.position = new Vector3(transform.position.x, floorLock, 0); Velocity.y = 0; grounded = true; playerState = MovmentState.run; glideTimer = GLIDE_TIME; } }
void DoGlide() { glideTimer -= Time.deltaTime; if (transform.position.y < 2.5) { DoJump(); } else if (Velocity.y != 0) { Velocity.y = 0; } HorisontalMovment(); if (glideTimer <= 0 || !Input.GetButton("Glide")) { playerState = MovmentState.jump; } }
void Start() { playerState = MovmentState.run; glideTimer = GLIDE_TIME; }