Beispiel #1
0
    // Fuction for dropdown
    public void ModeDropdownIndexChanged()
    {
        TrafficLightMode mode = (TrafficLightMode)modeDropdown.value;

        trafficLights.SetMode(mode);

        switch (mode)
        {
        case TrafficLightMode.Off:
            currentSignalText.text = "";
            trafficLights.SetSignalNum((int)TrafficLightsSignal.Off);
            break;

        case TrafficLightMode.Regulated:
            currentSignalText.text = TrafficLightsSignal.Red.ToString();
            trafficLights.SetSignalNum((int)TrafficLightsSignal.Off);
            break;

        case TrafficLightMode.NotRegulated:
            currentSignalText.text = TrafficLightsSignal.FlashingYellow.ToString();
            trafficLights.SetSignalNum((int)TrafficLightsSignal.FlashingYellow);
            break;

        case TrafficLightMode.Check:
            currentSignalText.text = TrafficLightsSignal.Red.ToString();
            trafficLights.SetSignalNum((int)TrafficLightsSignal.Red);
            break;
        }

#if UNITY_EDITOR
        Debug.Log("Selecting " + modeDropdown.options[modeDropdown.value].text + ".. mode .. ");
#endif
    }
Beispiel #2
0
 // Function for setup mode for traffic lights
 public void SetMode(TrafficLightMode _mode)
 {
     mode = _mode;
 }