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