public void Toggle() { if (_direction == DimmableDirection.Up) { if (_currentStep < _maxStep) { _currentStep++; } if (_currentStep == _maxStep) { _direction = DimmableDirection.Down; } } else { if (0 < _currentStep) { _currentStep--; } if (_currentStep == 0) { _direction = DimmableDirection.Up; } } DisplayState(); }
public DimmableLight() { _maxStep = _colorSteps.Length - 1; _currentStep = 0; _direction = DimmableDirection.Up; }