예제 #1
0
    void Awake()
    {
        var startGame = new Subject <Unit>();

        startButton.OnClickAsObservable().Subscribe(_ =>
        {
            blind.enabled = true;
            blind.Play("eyeEffect_UI_blink", 0, 0);
            DOVirtual.DelayedCall(startDelay, () =>
            {
                Destroy(heroInTitle.gameObject);
                this.gameObject.SetActive(false);
                notOnCanvas.SetActive(false);
                audio.Stop();
                startGame.OnNext(Unit.Default);
            });
        });
        rankingButton.OnClickAsObservable().Subscribe(_ =>
        {
            blind.enabled = true;
            blind.Play("eyeEffect_UI_blink", 0, 0);
            DOVirtual.DelayedCall(startDelay, () =>
            {
                this.gameObject.SetActive(false);
                notOnCanvas.SetActive(false);

                ranking.Enter();
                ranking.IsActive.Where(active => !active).Take(1).Subscribe(__ =>
                {
                    this.gameObject.SetActive(true);
                    notOnCanvas.SetActive(true);
                });
            });
        });
        StartGame = startGame;

        ranking.IsActive.Subscribe(active =>
        {
            heroInTitle.AcceptsInput = !active;
        });


        audio.clip   = SoundDatabase.Instance.bgmTitle;
        audio.volume = 0.6f;
        audio.loop   = true;
        audio.Play();
    }
예제 #2
0
    void Awake()
    {
        restartButton.OnClickAsObservable()
        .Subscribe(_ => OnRestart());

        tweetButton.OnClickAsObservable().Subscribe(_ =>
        {
            Tweet(tweetText.Replace("[score]", scoreCounter.Score.Value.ToString()));
        });

        rankingButton.OnClickAsObservable().Subscribe(_ =>
        {
            Blink();
            DOVirtual.DelayedCall(0.5f, () =>
            {
                BG.gameObject.SetActive(false);
                scoreViewBody.gameObject.SetActive(false);
                rankingButton.gameObject.SetActive(false);
                tweetButton.gameObject.SetActive(false);
                restartButton.gameObject.SetActive(false);
                dead.gameObject.SetActive(false);
                gameObject.SetActive(false);

                ranking.Enter(scoreCounter.Score.Value);

                ranking.IsActive.Where(active => !active).Take(1)
                .Subscribe(__ =>
                {
                    BG.gameObject.SetActive(true);
                    scoreViewBody.gameObject.SetActive(true);
                    rankingButton.gameObject.SetActive(true);
                    tweetButton.gameObject.SetActive(true);
                    restartButton.gameObject.SetActive(true);
                    dead.gameObject.SetActive(true);
                    dead.Play("dead_loop", 0, 0);
                    gameObject.SetActive(true);
                });
            });
        });
    }