public virtual void fireAlarm(SecurityZone zone, Sensor sensor)
 {
     Console.WriteLine(this.name + sensor.position + "水喷洒器打开了");
     if (parent != null)
     {
         parent.fireAlarm(zone, sensor);
     }
 }
 public override void fireAlarm(SecurityZone zone, Sensor sensor)
 {
     if (zone is Area)
     {
         Console.WriteLine("保安请马上去检查{0}的{1}", this.name, zone.name);
         if (GetParent() != null)
         {
             GetParent().fireAlarm(zone, sensor);
         }
         return;
     }
     base.fireAlarm(zone, sensor);
 }
示例#3
0
 public override void fireAlarm(SecurityZone zone, Sensor sensor)
 {
     if (zone is Area)
     {
         Console.WriteLine("{0}栋大楼发生火警", name);
         if (GetParent() != null)
         {
             GetParent().fireAlarm(zone, sensor);
         }
         return;
     }
     base.fireAlarm(zone, sensor);
 }
 public void SetParent(SecurityZone zone)
 {
     this.parent = zone;
 }