예제 #1
0
        private void Start()
        {
            mediator = GetComponent <PlayerMediator>();

            specialPoint
            .Subscribe(x => mediator.OnSpecialChanged(x / maxSpecialPoint))
            .AddTo(this);

            // ポイントが最大になったらバフ
            specialPoint
            .Where(x => x >= maxSpecialPoint && !isBuffing)
            .Subscribe(_ => {
                isBuffing = true;
                mediator.StartBuff();
                CutInAsync().Forget();
            })
            .AddTo(this);

            // ポイントが0になったらバフ解除
            specialPoint
            .Where(x => x <= 0 && isBuffing)
            .Subscribe(_ => {
                isBuffing = false;
                mediator.StopBuff();
                bgmPlayer.Play(soundDatabase.MainBgm);
            })
            .AddTo(this);
        }
예제 #2
0
        private void Start()
        {
            mediator = GetComponent <PlayerMediator>();

            this.ObserveEveryValueChanged(x => x.health)
            .Where(x => x <= 0)
            .Subscribe(_ => SceneMover.Restart().Forget())
            .AddTo(this);
        }