public static void Flash(ILightState pState, Light light, Color pFlashColor, int flashRate) { List <Light> lights = new List <Light>(); lights.Add(light); Flash(pState, lights, pFlashColor, flashRate); }
public void ChangeState(ILightState state, int changesCount, ColourOption[] colours) { var actual = TrafficManager.Start(state, changesCount); int i = 0; foreach (var element in actual) { Assert.AreEqual(element, colours[i++]); } }
/// <summary> /// Run cycle of change states for traffic light /// </summary> /// <param name="initState"> Initial state </param> /// <param name="shiftsNumber"> Number of changes states </param> /// <returns> Collection of colours </returns> /// <exception cref="ArgumentNullException"> If initState is null </exception> public static IEnumerable <ColourOption> Start(ILightState initState, int shiftsNumber) { var trafficLight = new TrafficLightState(initState); for (int i = 0; i < shiftsNumber; i++) { yield return(trafficLight.Colour); trafficLight.Change(); } }
public void TouchButton() { if (_current.IsLightOn) { _current = _offLight; } else { _current = _onLight; } }
public static void Flash(ILightState pState, List<Light> pLightRange, Color pFlashColor, int flashRate) { foreach (Light l in pLightRange) { l.Color = pFlashColor; pState.Update(); Thread.Sleep(flashRate); } }
public static void Flash(ILightState pState, List <Light> pLightRange, Color pFlashColor, int flashRate) { foreach (Light l in pLightRange) { l.Color = pFlashColor; pState.Update(); Thread.Sleep(flashRate); } }
public AmpSinePresenter(IAmpSineView pView, ILightState pState, LightGroup pGroup) : base(pView, pState) { mLightGroup = pGroup; Initialize(pView); }
public LightModulePresenterBase(ILightState pLightState) { mLightState = pLightState; }
public void SetState(ILightState s) { _lightState = s as LightState; }
public Context(ILightState state) { this.state = state; }
public LightSwitch(ILightState lightState) { this.lightState = lightState; }
// Use this for initialization void Start() { rend = GetComponent <Renderer>(); currentState = redLight; }
public static void Flash(ILightState pState, Light light, Color pFlashColor, int flashRate) { List<Light> lights = new List<Light>(); lights.Add(light); Flash(pState, lights, pFlashColor, flashRate); }
public void pressedFix() { this.state = state.Fix(); }
public LightControl(ILightState state) { State = state; }
public LightGroup(List <LightViewPresenter> pLightViews, ILightState pState) { mLights = pLightViews; mState = pState; }
public void fixSwitch() { this.state = state.Fix(); }
public void PressedOn() { this.state = state.TurnOn(); }
/// <summary> /// Initialize TrafficLightState by initial state /// </summary> /// <param name="state"> State of traffic light </param> public TrafficLightState(ILightState state) { State = state; }
public void Fix() { this.state = state.Fix(); }
public void Init(ILightState state) { this.State = state; }
public void onPress() { this.lightState = this.lightState.toogleLight(); }
public LightModulePresenterBase(IModuleView pView, ILightState pLightState) : this(pLightState) { mModuleView = pView; }
public void pressedOff() { this.state = state.TurnOff(); }
public LightGroup(List<LightViewPresenter> pLightViews, ILightState pState) { mLights = pLightViews; mState = pState; }
public AmpSinePresenter(IAmpSineView pView, ILightState pState) : base(pView, pState) { Initialize(pView); }
public StateManager2() { _onLight = new LightStateOn(this); _offLight = new LightStateOff(this); _current = null; }