private void movementModifier(bool running, Vector2 inputDir) { if (running && playerStamina.HasStamina() && inputDir[1] > 0) { playerStamina.LoseStamina(); } if (!running) { playerStamina.RecoverStamina(); } }
void ParagliderMovement() { playerStamina.LoseStamina(staminaRate); gliderGeo.SetActive(true); wind.SetActive(true); //Debug.Log("Stamina: " + playerStamina.stamina); //Debug.Log("Gliding"); if (velocity.y < gliderGravity) { velocity.y = gliderGravity; } float x = Input.GetAxis("Horizontal"); float z = Input.GetAxis("Vertical"); Vector3 move = transform.right * x + transform.forward * z; controller.Move(move * gliderSpeed * Time.deltaTime); velocity.y += gliderGravity * Time.deltaTime; controller.Move(velocity * Time.deltaTime); }