예제 #1
0
    public void Initialize(TrafficLight trafficLight)
    {
        CarWaitingState      = new CarWaitingState(this);
        CarDriveForwardState = new CarDriveForwardState(this);

        _trafficLight = trafficLight;

        _currentState = CarDriveForwardState;
        _currentState.Enter();
    }
예제 #2
0
 public void ChangeState(ICarState newstate)
 {
     _currentState = newstate;
     newstate.Enter();
 }