Example #1
0
    void Start()
    {
        redState    = new RedState(this);
        blueState   = new BlueState(this);
        yellowState = new YellowState(this);

        currentState = yellowState;
    }
        public TrafficLight()
        {
            IState redState = new RedState(this);

            _yellowState = new YellowState(this);
            _greenState  = new GreenState(this);
            _state       = redState;
        }
Example #3
0
 // Use this for initialization
 void Start()
 {
     bulbs.Add("Red", objs[2]);
     bulbs.Add("Green", objs[0]);
     bulbs.Add("Yellow", objs[1]);
     greenState   = new GreenState(this);
     redState     = new RedState(this);
     yellowState  = new YellowState(this);
     currentState = redState;
     m_timer      = 0f;
 }