Пример #1
0
        public static void Check(Evil evil, Weapon weapon)
        {
            for (int i = 0; i < evil.enemies.Count; ++i)
            {
                for (int j = 0; j < weapon.bullets.Count; ++j)
                {
                    if (Check(evil.enemies[i], weapon.bullets[j]))
                    {
                        float h = evil.enemies[i].Health;
                        evil.enemies[i].Health -= weapon.bullets[j].Health;
                        weapon.bullets[j].Health -= h;
                        bool b = false;
                        if (evil.enemies[i].Health <= 0)
                        {
                            evil.enemies.RemoveAt(i);
                            --i;
                            b = true;
                        }
                        if (weapon.bullets[j].Health <= 0)
                        {
                            weapon.bullets.RemoveAt(j);
                            j = !b ? j - 1 : weapon.bullets.Count;
                        }
                    }
                }

            }
        }
Пример #2
0
 public static void Check(Evil evil, Weapon weapon)
 {
     for (int i = 0; i < evil.enemies.Count; ++i)
     {
         for (int j = 0; j < weapon.bullets.Count; ++j)
         {
             if (Check(evil.enemies[i], weapon.bullets[j]))
             {
                 float enemy_health = evil.enemies[i].Health;
                 evil.enemies[i].Health   -= weapon.bullets[j].Health;
                 weapon.bullets[j].Health -= enemy_health;
             }
         }
     }
 }