Exemplo n.º 1
0
        public void SetSignalState(string state)
        {
            if (!ValidStates.Contains(state))
            {
                Debug.LogWarning($"'{state}' is an invalid state for '{ControlType}'");
                return;
            }

            CurrentState = state;
            CurrentSignalLight.SetSignalLightState(state);
            switch (CurrentState)
            {
            case "red":
                stopLine.currentState = SignalLightStateType.Red;
                break;

            case "green":
                stopLine.currentState = SignalLightStateType.Green;
                break;

            case "yellow":
                stopLine.currentState = SignalLightStateType.Yellow;
                break;

            case "black":
                stopLine.currentState = SignalLightStateType.Black;
                break;
            }
        }
Exemplo n.º 2
0
        public void SetSignalState(string state)
        {
            if (!ValidStates.Contains(state))
            {
                Debug.LogError($"'{state}' is an invalid state for '{ControlType}'");
                return;
            }

            CurrentState = state;
            switch (CurrentState)
            {
            case "red":
                stopLine.currentState = SignalLightStateType.Red;
                signalLightMesh.material.SetTextureOffset("_EmissiveColorMap", new Vector2(0f, 0.65f));
                signalLightMesh.material.SetColor("_EmissiveColor", Color.red);
                signalLightMesh.material.SetVector("_EmissiveColor", Color.red * 3.0f);
                break;

            case "green":
                stopLine.currentState = SignalLightStateType.Green;
                signalLightMesh.material.SetTextureOffset("_EmissiveColorMap", new Vector2(0f, 0f));
                signalLightMesh.material.SetColor("_EmissiveColor", Color.green);
                signalLightMesh.material.SetVector("_EmissiveColor", Color.green * 3.0f);
                break;

            case "yellow":
                stopLine.currentState = SignalLightStateType.Yellow;
                signalLightMesh.material.SetTextureOffset("_EmissiveColorMap", new Vector2(0f, 0.35f));
                signalLightMesh.material.SetColor("_EmissiveColor", Color.yellow);
                signalLightMesh.material.SetVector("_EmissiveColor", Color.yellow * 3.0f);
                break;

            case "black":
                stopLine.currentState = SignalLightStateType.Black;
                signalLightMesh.material.SetColor("_EmissiveColor", Color.black);
                signalLightMesh.material.SetVector("_EmissiveColor", Color.black * 3.0f);
                break;

            default:
                break;
            }
        }