void Update() { CollisionCheck(); if (_isHoldingWeapon) { _hit.collider.gameObject.transform.position = Hold.position; } Vector2 input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); //Control Code /// //// ///// ////// if (!_controller.collisions.below) { airTime += Time.deltaTime; if (_controller.collisions.below) { airTime = 0; } } if (_playerCurrentEnegy < _playerMaxEnegy) { _playerCurrentEnegy += rechargeRate * Time.deltaTime; } if (Input.GetKeyDown(KeyCode.E)) { PickupItem(); } if (Input.GetKeyDown(KeyCode.Q)) { //TODO:: Throw the shit } if (Input.GetKeyDown(KeyCode.Tab)) { //TODO:: Inventory shit } if (Input.GetKeyDown(KeyCode.LeftControl)) { //TODO:: hiding & disable player attack shit } if (Input.GetKeyDown(KeyCode.LeftShift)) { if (_buttoncooldown > 0 && _buttoncount == 1) { _dashcount++; _controller.Dash(input, _dashForce); } else { _buttoncooldown = 0.5f; _buttoncount += 1; } } if (_buttoncooldown > 0) { _buttoncooldown -= 1 * Time.deltaTime; } else { _buttoncount = 0; } if (Input.GetKeyDown(KeyCode.Space)) { Jump(); } if (Input.GetKeyDown(KeyCode.Z)) { Restart(); } ///// //// /// // if (_playerHp <= 0) { Dead(); } float targetVelocityX = input.x * moveSpeed; velocity.x = Mathf.SmoothDamp(velocity.x, targetVelocityX, ref _velocityXSmoothing, (_controller.collisions.below)?accelerationTimeGrounded:accelerationTimeAirborne); velocity.y += gravity * Time.deltaTime; _controller.Move(velocity * Time.deltaTime); OnBoostBlock = false; }