Пример #1
0
    private void Awake()
    {
        ship.Clear();

        ship.IsGameOver
        .Delay(TimeSpan.FromSeconds(2))
        .Subscribe(c =>
        {
            if (this.CurrentStateIsGamePlay && c)
            {
                CurrentState.Value = global::State.Result;
            }
        });

        CurrentState.Subscribe(s =>
        {
            switch (s)
            {
            case State.Title:
                BgmManager.Instance.Play("GGR_bgm02_result");
                break;

            case State.GamePlay:
                BgmManager.Instance.Play("GGR_bgm01_main");
                break;

            case State.Result:
                BgmManager.Instance.Play("GGR_bgm02_result");
                break;

            default:
                throw new NotImplementedException();
            }
        });
    }