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; }
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(); }