/// <summary>
 /// constructor needs a minumum time spent green (default = 10 sec)
 /// </summary>
 /// <param name="minTimeSpentGreen">int in seconds</param>
 public TrafficLight(int minTimeSpentGreen = 10, int maxTimeSpentGreen = 120)
 {
     currentState = lightColor.red;
     this.maxTimeSpentGreen = maxTimeSpentGreen;
     this.minTimeSpentGreen = minTimeSpentGreen;
     maybeEddited = true;
 }
    private void SetCurrentState(lightColor state)
    {
        currentState = state;

        switch (currentState)
        {
        case lightColor.green:
            trafficLight.color = Color.green;
            break;

        case lightColor.yellow:
            trafficLight.color = Color.yellow;
            break;

        case lightColor.red:
            trafficLight.color = Color.red;
            break;
        }
    }
 /// <summary>
 /// this changes the State of the trafficlight to the given lightcolor (only call when it's changed!)
 /// </summary>
 public void setTrafficLight(lightColor color)
 {
     if (color == lightColor.red) {//the color is changed to red so we need to set that timer to 0
         timeSpentRed = 0;
         maybeEddited = true;
     }
     if (color == lightColor.yellow)
     {//the color is changed to yellow so we need to set that timer to 0
         timeSpentYellow = 0;
         maybeEddited = false;
     }
     if (color == lightColor.green || color == lightColor.right || color == lightColor.straightforward
         || color == lightColor.straightforwardRight)
     {//the color is changed to green or something equal so we need to set that timer to 0
         timeSpentGreen = 0;
         maybeEddited = false;
     }
     this.currentState = color;
 }