示例#1
0
        public override void changeBurntLamps(IIlluminate place)
        {
            Checking();
            this.Vehicle.GetSate().TurnOn();
            this.Vehicle.TurnOnSiren();
            this.Vehicle.Drive();
            if (this.Vehicle.GetSate().GetType() == typeof(Broken))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"\nOh no! the electrician's vehicle has broken and now he can not change the lamps.\n");
                Console.ResetColor();
                return;
            }
            else
            {
                // While the vehicle is not at rest, it slows down so that it can be switched off.
                if (this.Vehicle.GetSate().GetType() != typeof(StandOff) && this.Vehicle.GetSate().GetType() != typeof(TurnedOff))
                {
                    this.Vehicle.GetSate().Brake();
                }

                this.Vehicle.GetSate().TurnOff();
                Console.WriteLine(this.Vehicle.GetSate().ToString());
            }

            this.Tool.Use();
            place.CheckAndChangeBurntLamps();
            this.Tool.PutAway();
        }
 public virtual void changeBurntLamps(IIlluminate place)
 {
     if (this.Heroe != null)
     {
         this.Heroe.changeBurntLamps(place);
     }
 }
示例#3
0
 public void RemovePlace(IIlluminate place)
 {
     this.Places.Remove(place);
 }
示例#4
0
 public void AddPlace(IIlluminate place)
 {
     this.Places.Add(place);
 }