private void switchLightsToStop(StopLightBehavior[] lights, float delay){

			float sanatizedDelay = Mathf.Clamp (delay, 0, 100000);

			for (int i = 0; i < lights.Length; i++) {

				if (delay != 0) {

					lights [i].changeToYellow ();
					lights [i].changeToRed (sanatizedDelay);

				} else {

					lights [i].changeToRed ();

				}

			}

		}
		/// <summary>
		/// Adds the stop light to the east/west category.
		/// </summary>
		/// <param name="stoplight">Stoplight.</param>
		public void addEastWestStopLight(StopLightBehavior stoplight){
			this.eastWestStopLights.Add (stoplight);
		}
Esempio n. 3
0
 /// <summary>
 /// Adds the stop light to the east/west category.
 /// </summary>
 /// <param name="stoplight">Stoplight.</param>
 public void addEastWestStopLight(StopLightBehavior stoplight)
 {
     this.eastWestStopLights.Add(stoplight);
 }
		/// <summary>
		/// Adds the stop light to the north/south category.
		/// </summary>
		/// <param name="stoplight">Stoplight.</param>
		public void addNorthSouthStopLight(StopLightBehavior stoplight){
			this.northSouthStopLights.Add (stoplight);
		}
Esempio n. 5
0
 /// <summary>
 /// Adds the stop light to the north/south category.
 /// </summary>
 /// <param name="stoplight">Stoplight.</param>
 public void addNorthSouthStopLight(StopLightBehavior stoplight)
 {
     this.northSouthStopLights.Add(stoplight);
 }