Exemple #1
0
    private void ReadInput()
    {
        if (_actionMapper.RacquetSwing())
        {
            if (_pointManager.IsServing(playerId) && !hitServiceBall && _hitMethod == null)
            {
                if (_servePowerOscillating)
                {
                    _servePowerOscillating = false;
                    _servePowerFactor      = _serveSpeedManager.StopPowerOscillation();
                    _movementBlocked       = true;
                    StartService();
                }
                else
                {
                    _servePowerOscillating = true;
                    _movementBlocked       = true;
                    _serveSpeedManager.StartPowerOscillation();
                }
            }
            else if (CanHitBall())
            {
                ballInsideHitZone = false; // Cannot hit ball twice
                SelectHitMethod();
                _movementBlocked = true;
            }
        }

        if (_movementBlocked)
        {
            if (_hitMethod == HitMethod.Serve)
            {
                ReadServiceDirection();
            }
            else
            {
                ReadHitDirection();
            }
        }
        else
        {
            ReadMovementInput();
        }
    }