public override void Handle(TrafficLight light) { Console.WriteLine("绿灯行"); light.SetState(LightStateFactory.GetLightState <YellowState>()); }
public override void Handle(TrafficLight light) { Console.WriteLine("黄灯亮了等一等"); light.SetState(LightStateFactory.GetLightState <RedState>()); }
public override void Handle(TrafficLight light) { Console.WriteLine("红灯停"); light.SetState(LightStateFactory.GetLightState <GreenState>()); }