Exemple #1
0
        private void Start()
        {
            _gameStateModel.SetStageNum(_stageObjects.Length);
            var stream = _gameStateModel.OnGameStateChanged
                         .TakeUntilDestroy(this)
                         .Publish()
                         .RefCount();

            stream.Where(s => s == GameState.OnPlay)
            .Subscribe(_ => CreateStage(_gameStateModel.GetStage()));

            stream.Where(s => s == GameState.Non)
            .Subscribe(_ => ReturnTitle());
        }
Exemple #2
0
        private void Bind()
        {
            _startButton.OnClickAsObservable()
            .TakeUntilDestroy(this)
            .ThrottleFirst(TimeSpan.FromMilliseconds(500))
            .Subscribe(_ =>
            {
                _audioManager.Play(Clip.Apply);
                _windowPresenter.OnStateChanged((int)ScreenState.Game);
                _stateModel.SetGameState(GameState.OnPlay);
            });

            _optionButton.OnClickAsObservable()
            .TakeUntilDestroy(this)
            .ThrottleFirst(TimeSpan.FromMilliseconds(500))
            .Subscribe(_ =>
            {
                _audioManager.Play(Clip.Apply);
                _windowPresenter.OnStateChanged((int)ScreenState.Option);
            });

            _plusButton.OnClickAsObservable()
            .TakeUntilDestroy(this)
            .Subscribe(_ =>
            {
                _audioManager.Play(Clip.Apply);
                _stateModel.SetStage(_stateModel.GetStage() + 1);
            });
            _minusButton.OnClickAsObservable()
            .TakeUntilDestroy(this)
            .Subscribe(_ =>
            {
                _audioManager.Play(Clip.Apply);
                _stateModel.SetStage(_stateModel.GetStage() - 1);
            });
        }
 private async void NextStage()
 {
     _stateModel.SetStage(_stateModel.GetStage() + 1);
     _stateModel.SetGameState(GameState.OnPlay);
 }
Exemple #4
0
 private void Initialize()
 {
     _audioManager.Play(Clip.Clear);
     _stageLabel.text = $"Stage {_stateModel.GetStage() + 1}";
 }