Пример #1
0
        public void AddFruit(String Name, Point Location)
        {
            Fruit NewFruit;

            if (Name.Equals("Watermelon"))
            {
                NewFruit = new Watermelon(Name, Location, DirectionOfFruit, 35);
            }
            else if (Name.Equals("Pineapple"))
            {
                NewFruit = new Pineapple(Name, Location, DirectionOfFruit, 35);
            }
            else if (Name.Equals("Apple"))
            {
                NewFruit = new Apple(Name, Location, DirectionOfFruit, 35);
            }
            else if (Name.Equals("Orange"))
            {
                NewFruit = new Orange(Name, Location, DirectionOfFruit, 35);
            }
            else if (Name.Equals("Strawberry"))
            {
                NewFruit = new Strawberry(Name, Location, DirectionOfFruit, 35);
            }
            else
            {
                NewFruit = new Bomb(Name, Location, DirectionOfFruit, 35);
            }
            AllFruits.Add(NewFruit);
        }
Пример #2
0
 private void deleteFruits()
 {
     for (int i = 0; i < AllFruits.Count; i++)
     {
         if (AllFruits[i].State == 0)
         {
             if (AllFruits[i].Name.Equals("Bomb") && AllFruits[i].IsHit)
             {
                 GameOver = true;
             }
             if (AllFruits[i].IsHit)
             {
                 TotalPoints += AllFruits[i].Points;
             }
             if (!AllFruits[i].Name.Equals("Bomb") && !AllFruits[i].IsHit)
             {
                 Misses++;
             }
             AllFruits.RemoveAt(i);
             if (Misses == 3)
             {
                 GameOver = true;
             }
         }
     }
 }
Пример #3
0
 public void RemoveAll()
 {
     AllFruits.Clear();
 }