public void ChangeLight() { var nextValue = (int)this.Light + 1; if (nextValue == this.lightsCount) { nextValue = 0; } var nextLight = (TLightColor)nextValue; this.Light = nextLight; }
public TrafficLight(TLightColor light) { this.Light = light; this.lightsCount = Enum.GetNames(typeof(TLightColor)).Length; }