Exemple #1
0
        public BallHandler(BallKind ballKind)
        {
            _ballKind = ballKind;
            Alkar.Inject(this);

            _input = _ballInputFactory.Get(ballKind);

            _input.TrackHandler(this);

            RotationTorque = _input
                             .RawDirection
                             .Select(
                x => x * _ballSettings.Speed * Time.deltaTime
                )
                             .Select(x => x * Vector3.forward);

            JumpForce = _input
                        .Jump
                        .Where(_ => _touchingFloor)
                        .Select(_ => _ballSettings.JumpForce)
                        .ThrottleFirst(TimeSpan.FromSeconds(JumpThrottleSeconds));
        }
Exemple #2
0
 public BallInputFactory(IBallInput player, PlayerPositionService positionService, IBallSettings ballSettings)
 {
     _player          = player;
     _positionService = positionService;
     _ballSettings    = ballSettings;
 }