private void ReadInput() { moveLeftRightValue = 0; moveForwardBackwardValue = 0; _finishHitting = false; BallLogic ball = BallLogic.Instance; if (ActionMapper.GetMoveLeft(leftButton, horizontalAxis)) { moveLeftRightValue += -1; } if (ActionMapper.GetMoveRight(rightButton, horizontalAxis)) { moveLeftRightValue += 1; } if (ActionMapper.GetMoveForward(forwardButton, verticalAxis)) { moveForwardBackwardValue += 1; } if (ActionMapper.GetMoveBackward(backwardButton, verticalAxis)) { moveForwardBackwardValue += -1; } if (ActionMapper.GetHitPressed(hitButton, hitJoystickButton) && ball.GetHittingPlayer() != _id) { if (!_isCharging && _isServing) { _currentHitForce = minHitForce; _isCharging = true; } else if (!_isCharging && ball.GetHittingPlayer() != 0) { _currentHitForce = minHitForce; if (!_isServing) { aimTarget.position = _aimStartPosition; _ballSide = BallLogic.Instance.GetSide(transform.position); _playerAnimation.StartHittingAnimation(_ballSide); } _isCharging = true; } else if (_isCharging) { _currentHitForce += deltaHitForce * Time.deltaTime; _currentHitForce = Math.Min(_currentHitForce, maxHitForce); } } if (ActionMapper.GetHitReleased(hitButton, hitJoystickButton)) { if (_isServing && ball.GetHittingPlayer() == 0) { _isCharging = false; _playerAnimation.StartServeAnimation(); _animatedServingBall = Instantiate(animatableServeBallPrefab, transform.position + Vector3.up * animatableServeBallPrefab.GetComponent <BallServeAnimation>().verticalAppearOffset, Quaternion.identity); } } }