Example #1
0
        public void Activate()
        {
            var stage = 0;

            while (true)
            {
                switch (stage)
                {
                case 0:
                    _trafficLight.SetRed();
                    LongWait();
                    break;

                case 1:
                    _trafficLight.SetRedAndYellow();
                    ShortWait();
                    break;

                case 2:
                    _trafficLight.SetGreen();
                    LongWait();
                    break;

                case 3:
                    _trafficLight.SetYellow();
                    stage = -1;
                    ShortWait();
                    break;
                }

                stage++;
            }
        }
Example #2
0
        private void OnBuildStateFetched(BuildState state)
        {
            switch (state)
            {
            case BuildState.red:
                _trafficLight.SetRed();
                break;

            case BuildState.red_anime:
                _trafficLight.SetRedAndYellow();
                break;

            case BuildState.yellow:
                _trafficLight.SetYellow();
                break;

            case BuildState.yellow_anime:
                _trafficLight.SetRedAndYellow();
                break;

            case BuildState.blue:
                _trafficLight.SetGreen();
                break;

            case BuildState.blue_anime:
                _trafficLight.SetYellowAndGreen();
                break;

            case BuildState.grey:
            case BuildState.disabled:
                _trafficLight.SetOff();
                break;

            default:
                throw new Exception("Unrecognised state: " + state);
            }
        }