Ejemplo n.º 1
0
        static void Main()
        {
            Bunny vankataBunny = new Bunny("Vankata");
            ulong currentVankataCarrots = vankataBunny.AddCarrots(100);

            Bunny peshoBunny = new Bunny("Pesho00", ColorType.Blue);
            ulong currentPEshoCarrots = peshoBunny.AddCarrots(2000);

            vankataBunny.Health -= 250;
            vankataBunny.Retire();
            vankataBunny.Color = ColorType.Red;

            var baiGosho = new Bunny("Goshoo");
            ChangeBunny(baiGosho);
            Console.WriteLine(baiGosho.Health);

            Random random = new Random();

            var bunnies = new List<Bunny>();
            for (int i = 0; i < 100; i++)
            {
                Bunny currentBunny = new Bunny(new string((char)i, 10));
                currentBunny.Health = random.Next(0, 100);
                bunnies.Add(currentBunny);
            }

            //foreach (var bunny in bunnies)
            //{
            //    Console.WriteLine(bunny.Name + " " + bunny.Health);
            //}

            var vankataAndPesho = new List<Bunny>
            {
                vankataBunny, peshoBunny
            };

            foreach (var bunnyes in vankataAndPesho)
            {
                Console.WriteLine(bunnyes.Name);
            }

            AirCraft firstAircraft = new AirCraft(vankataBunny, 50);
            AirCraft secondAircraft = new AirCraft(peshoBunny, 100);
            firstAircraft.Attack(secondAircraft);
            Console.WriteLine(secondAircraft.Pilot.Health);

            firstAircraft.Move(new Coordinates(15, 20));
            secondAircraft.Move(new Coordinates(25, 40));

            double distance = AirCraft.CalculateDistance(firstAircraft, secondAircraft);
            Console.WriteLine(distance);
            Console.WriteLine(vankataBunny.DamageTaken);
        }
Ejemplo n.º 2
0
 public static double CalculateDistance(AirCraft first, AirCraft second)
 {
     double xDistance = (first.Coordinates.X - second.Coordinates.X) * (first.Coordinates.X - second.Coordinates.X);
     double yDistance = (first.Coordinates.Y - second.Coordinates.Y) * (first.Coordinates.Y - second.Coordinates.Y);
     return Math.Sqrt(xDistance + yDistance);
 }
Ejemplo n.º 3
0
 public void Attack(AirCraft target)
 {
     if (this.Pilot.Color == target.Pilot.Color)
     {
         return;
     }
     target.Pilot.Health -= this.Damage;
 }