예제 #1
0
 public void OnDecrease(Action action) => _decrease.OnPowerOn(() =>
 {
     if (_increase.Power == PowerValue.Off)
     {
         action();
     }
 });
예제 #2
0
        public void Run()
        {
            _redButton.OnPowerOn(() => Guess(Color.Red));
            _yellowButton.OnPowerOn(() => Guess(Color.Yellow));
            _greenButton.OnPowerOn(() => Guess(Color.Green));

            _difficultyDial.OnIncrease(() =>
            {
                if (_difficulty < 3)
                {
                    _difficulty++;
                }
                StartRound();
            });

            _difficultyDial.OnDecrease(() =>
            {
                if (_difficulty > 1)
                {
                    _difficulty--;
                }
                StartRound();
            });

            _score      = 0;
            _difficulty = 1;

            _cpuRed.TurnOnFor(TimeSpan.FromSeconds(0.5));
            _cpuYellow.TurnOnFor(TimeSpan.FromSeconds(0.5));
            _cpuGreen.TurnOnFor(TimeSpan.FromSeconds(0.5));
            _score1.TurnOnFor(TimeSpan.FromSeconds(0.5));
            _score2.TurnOnFor(TimeSpan.FromSeconds(0.5));
            _score3.TurnOnFor(TimeSpan.FromSeconds(0.5));

            StartRound();
        }