Esempio n. 1
0
        public HudController(
            HudView view,
            GameStateModel gameStateModel,
            FlightStatsModel flightStatsModel,
            ProfileModel profileModel,
            UserInputModel userInputModel,
            CameraConfig cameraConfig)
            : base(view)
        {
            _view = view;
            _view.Initialize();

            _gameStateModel   = gameStateModel;
            _flightStatsModel = flightStatsModel;
            _profileModel     = profileModel;
            _userInputModel   = userInputModel;
            _cameraConfig     = cameraConfig;

            _view.OnPauseButtonClicked
            .Subscribe(_ => _userInputModel.OnPause.Execute())
            .AddTo(Disposer);

            SetupGameStateModel();
            SetupFlightStatsModel();
            SetupProfileModel();
        }
Esempio n. 2
0
        private void Inject(CameraConfig config, JesterEntity jester, FlightStatsModel flighStatsModel)
        {
            _config          = config;
            _jester          = jester;
            _flighStatsModel = flighStatsModel;

            _minFollowY = Position.y;
        }
Esempio n. 3
0
        public VelocityLimiter(JesterEntity owner, PlayerModel playerModel, FlightStatsModel flightStatsModel) :
            base(owner)
        {
            _playerModel      = playerModel;
            _flightStatsModel = flightStatsModel;

            Observable.EveryLateUpdate()
            .Subscribe(_ => OnLateUpdate())
            .AddTo(owner);
        }
        public RoundStatsRecorder(GameRoundEntity owner, GameStateModel gameStateModel, FlightStatsModel flightStatsModel, ProfileModel profileModel)
            : base(owner)
        {
            _gameStateModel   = gameStateModel;
            _flightStatsModel = flightStatsModel;
            _profileModel     = profileModel;

            _gameStateModel.OnRoundEnd
            .Subscribe(_ => OnRoundEnd())
            .AddTo(owner);
        }
Esempio n. 5
0
 private void Inject(
     JesterEntity jesterEntity,
     FlightStatsModel flightStatsModel,
     AudioService audioService,
     ParticleService particleService,
     MainCamera mainCamera)
 {
     _jesterEntity     = jesterEntity;
     _flightStatsModel = flightStatsModel;
     _audioService     = audioService;
     _particleService  = particleService;
     _mainCamera       = mainCamera;
 }
Esempio n. 6
0
        public FlightRecorder(JesterEntity owner, FlightStatsModel flightStatsModel)
            : base(owner)
        {
            origin            = owner.GoTransform.position;
            _flightStatsModel = flightStatsModel;

            owner.OnKicked
            .Subscribe(_ => _canCheckForIsLanded = true)
            .AddTo(owner);

            Observable.EveryLateUpdate()
            .Where(_ => !IsPaused.Value)
            .Subscribe(_ => LateUpdate())
            .AddTo(owner);
        }
Esempio n. 7
0
        public MotionShoot(JesterEntity owner, PlayerModel playerModel, FlightStatsModel flightStatsmodel, UserInputModel userInputModel)
            : base(owner)
        {
            _playerModel      = playerModel;
            _flightStatsmodel = flightStatsmodel;
            _userInputModel   = userInputModel;

            flightStatsmodel.ShotsRemaining.Value = playerModel.Shots;

            _userInputModel.OnClickedAnywhere
            .Subscribe(_ => OnKick())
            .AddTo(owner);

            owner.OnKicked
            .Subscribe(_ => _isInFlight = true)
            .AddTo(owner);

            owner.OnLanded
            .Subscribe(_ => _isInFlight = false)
            .AddTo(owner);
        }
        public CurrencyRecorder(
            GameRoundEntity owner,
            GameStateModel gameStateModel,
            FlightStatsModel flightStatsModel,
            ProfileModel profileModel,
            BalancingConfig config)
            : base(owner)
        {
            _gameStateModel   = gameStateModel;
            _flightStatsModel = flightStatsModel;
            _profileModel     = profileModel;
            _config           = config;


            _gameStateModel.OnRoundEnd
            .Subscribe(_ => OnRoundEnd())
            .AddTo(owner);

            MessageBroker.Default.Receive <CurrencyGainEvent>()
            .Subscribe(gainEvent => AddPickup(gainEvent.Amount))
            .AddTo(owner);
        }
Esempio n. 9
0
        public MotionBoot(
            JesterEntity owner,
            PlayerModel playerModel,
            FlightStatsModel flightStatsmodel,
            UserInputModel userInputModel,
            BootConfig bootConfig)
            : base(owner)
        {
            _playerModel      = playerModel;
            _flightStatsmodel = flightStatsmodel;
            _userInputModel   = userInputModel;
            _bootConfig       = bootConfig;

            OnKickActionSubscription = _userInputModel.OnClickedAnywhere
                                       .Subscribe(_ => OnKickUserAction())
                                       .AddTo(owner);

            OnJesterKickedSubscription = owner.OnKicked
                                         .Subscribe(_ => OnJesterKicked())
                                         .AddTo(owner);

            _kickForceTweener = DOTween
                                .To((x) => _flightStatsmodel.RelativeKickForce.Value = x, _bootConfig.MinForceFactor, _bootConfig.MaxForceFactor, _bootConfig.ForceFactorChangeSeconds)
                                .SetLoops(-1, LoopType.Yoyo);

            Owner.IsPaused.Subscribe(isPaused =>
            {
                if (isPaused && _kickForceTweener.IsPlaying())
                {
                    _kickForceTweener?.Pause();
                }
                else if (!_kickForceTweener.IsPlaying())
                {
                    _kickForceTweener?.Play();
                }
            })
            .AddTo(owner);
        }
        public RoundEndController(
            RoundEndView view,
            RoundEndModel roundEndModel,
            GameStateModel gameStateModel,
            FlightStatsModel flightStatsModel,
            ProfileModel profileModel,
            SceneTransitionService sceneTransitionService)
            : base(view)
        {
            _view = view;
            _view.Initialize();

            _roundEndModel          = roundEndModel;
            _gameStateModel         = gameStateModel;
            _flightStatsModel       = flightStatsModel;
            _profileModel           = profileModel;
            _sceneTransitionService = sceneTransitionService;

            currencyAmountAtStart = _profileModel.Currency.Value;
            bestDistanceAtStart   = _profileModel.BestDistance.Value;

            _view.OnRetryClicked
            .Subscribe(_ => OnRetryClicked())
            .AddTo(Disposer);

            _view.OnShopClicked
            .Subscribe(_ => OnShopClicked())
            .AddTo(Disposer);

            _view.OnOpenCompleted
            .Subscribe(_ => OnOpenCompleted())
            .AddTo(Disposer);


            SetupModelSubscriptions();
        }