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