예제 #1
0
 public override IBullet Fire(TypeOFBullets bulletType)
 {
     IBullet bullet = null;
         if (bulletType == TypeOFBullets.Cobblestone)
         {
             bullet = new Cobblestone(100, 100);
         }
         else if (bulletType == TypeOFBullets.BarrelBurn)
         {
             bullet = new BarrelWithBurnMix(100, 100);
         }
         else
         {
             bullet = new BarrelOfRottenFish(100, 100);
         }
     return bullet;
 }
예제 #2
0
        static void Exo02_03()
        {
            Cobblestone myCobblestone  = new Cobblestone(30, 20, 10);
            Cobblestone myCobblestone2 = new Cobblestone(25, 15, 5);

            WriteLine($"The volume of the cobblestone {myCobblestone.ToString()} is {myCobblestone.Volume}");
            WriteLine($"The volume of the cobblestone {myCobblestone2.ToString()} is {myCobblestone2.Volume}");
            WriteLine();

            myCobblestone2 = myCobblestone;
            WriteLine($"The volume of the cobblestone {myCobblestone.ToString()} is {myCobblestone.Volume}");
            WriteLine($"The volume of the cobblestone {myCobblestone2.ToString()} is {myCobblestone2.Volume}");
            WriteLine();

            myCobblestone2.Lenght = 10;
            myCobblestone2.Height = 25;
            myCobblestone2.Width  = 70;
            WriteLine($"The volume of the cobblestone {myCobblestone.ToString()} is {myCobblestone.Volume}");
            WriteLine($"The volume of the cobblestone {myCobblestone2.ToString()} is {myCobblestone2.Volume}");
        }