예제 #1
0
        private void Awake()
        {
            CurrentPlayer = new ReactiveProperty <PlayerType>();
            IsGameStarted = new BoolReactiveProperty();
            IsGameOver    = new BoolReactiveProperty();

            WinTheGame = IsGameOver.Select(_ => IsGameOver.Value).ToReactiveCommand <WinnerType>();
        }
    public void Test_Rx()
    {
        //Arrange
        var rx         = new BoolReactiveProperty();
        var gameObject = new GameObject();

        rx.Select(b => b.ToString()).RepeatUntilDestroy(gameObject).Subscribe(Debug.Log);
        rx.Value = true;
        rx.Value = true;
    }
예제 #3
0
파일: Game.cs 프로젝트: ly774508966/Alensia
        protected override void OnInitialized()
        {
            _timeScale
            .Where(_ => !Paused)
            .Subscribe(scale => Time.timeScale = scale, Debug.LogError)
            .AddTo(this);
            _paused
            .Select(v => v ? 0 : TimeScale)
            .Subscribe(scale => Time.timeScale = scale, Debug.LogError)
            .AddTo(this);

            base.OnInitialized();
        }