public void Initialize(TrafficLight trafficLight) { CarWaitingState = new CarWaitingState(this); CarDriveForwardState = new CarDriveForwardState(this); _trafficLight = trafficLight; _currentState = CarDriveForwardState; _currentState.Enter(); }
public void ChangeState(ICarState newstate) { _currentState = newstate; newstate.Enter(); }