Exemplo n.º 1
0
        public static void CleanSwarm(ref Swarm source)
        {
            for (int i = 0; i < source.countOfFly - 1; i++)
            {
                if (source.enemyFly[i].counter % source.enemyFly[i].speed == 0)
                {
                    if (!source.enemyFly[i].active)
                    {
                        for (int j = i; j < source.countOfFly - 1; j++)
                        {
                            source.enemyFly[j] = source.enemyFly[j + 1];
                        }

                        --source.countOfFly;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static void ShotAndFlyProcessing(ref Swarm enemies, ref Cartridge source, ref Display battle)
        {
            for (int i = 0; i < enemies.countOfFly; i++)
            {
                for (int j = 0; j < source.countOfShots; j++)
                {
                    if (IsHit(enemies.enemyFly[i], source.mag[j]))
                    {
                        if (source.mag[j].active)
                        {
                            source.mag[j].active     = false;
                            enemies.enemyFly[i].hit += 1;

                            if (enemies.enemyFly[i].hit >= HITS)
                            {
                                enemies.enemyFly[i].active = false;
                                battle.killed += 1;
                                //battle.enemies -= 1;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public static void CleanDataStructures(ref Swarm enemies, ref Cartridge shipMag)
        {
            CleanSwarm(ref enemies);

            CleanMag(ref shipMag);
        }