public static void ResetAll()
 {
     StartSpawns = false;
     boss        = null;
     wBoss       = null;
     enemies.Clear();
     ESpinner.CurrentCount = 0;
     EWorm.CurrentCount    = 0;
 }
 private void RemoveDead()
 {
     if (boss != null && boss.IsDead)
     {
         boss.Die();
         boss = null;
     }
     if (wBoss != null && wBoss.IsDead)
     {
         wBoss.Die();
         wBoss = null;
     }
     for (int i = 0; i < enemies.Count; i++)
     {
         if (enemies[i].IsDead)
         {
             enemies[i].Die();
             enemies.RemoveAt(i);
         }
     }
 }
        private void Spawn()
        {
            Vector2 pos    = new Vector2();
            Vector2 vel    = new Vector2();
            Vector2 centre = new Vector2(Game1.ScreenX / 2, Game1.ScreenY / 2);

            if (!bossMode)
            {
                if (currentTime / (SPAWN_A + stats.SpawnModifier) > counterA && stats.DividersOn)
                {
                    counterA++;
                    int numCreate = Game1.rand.Next(1, 2 + stats.SpawnAmountModifier);

                    for (int i = 0; i < numCreate; i++)
                    {
                        SetSpawnParameters(ref pos, ref vel, centre);
                        EDivider e = new EDivider(divideTex, pos, vel, 0);
                        enemies.Add((Enemy)e);
                    }
                }
                if (currentTime / (SPAWN_B + stats.SpawnModifier) > counterB && stats.ChasersOn)
                {
                    counterB++;
                    int numCreate = Game1.rand.Next(1, 6 + stats.SpawnAmountModifier);

                    for (int i = 0; i < numCreate; i++)
                    {
                        SetSpawnParameters(ref pos, ref vel, centre);
                        EChaser e = new EChaser(chaseTex, pos, vel);
                        enemies.Add((Enemy)e);
                    }
                }
                if (ESpinner.CurrentCount < MAX_SPINNERS && currentTime / (SPAWN_C + stats.SpawnModifier) > counterC && stats.SpinnersOn)
                {
                    counterC++;
                    int numCreate = Game1.rand.Next(1, 3);

                    for (int i = 0; i < numCreate; i++)
                    {
                        SetSpawnParameters(ref pos, ref vel, centre);
                        //vel *= ESpinner.SPEED;
                        ESpinner e = new ESpinner(spinTex, pos, vel);
                        enemies.Add((Enemy)e);
                    }
                }
                if (EWorm.CurrentCount < stats.MaxWorms && currentTime / (SPAWN_D + stats.SpawnModifier) > counterD && stats.WormsOn)
                {
                    counterD++;
                    int loopControl;
                    if (LevelManager.Mode == GameMode.Worms)
                    {
                        loopControl = stats.MaxWorms - EWorm.CurrentCount;
                    }
                    else
                    {
                        loopControl = stats.SpawnAmountModifier / 2;
                    }
                    for (int i = 0; i < loopControl; i++)
                    {
                        SetSpawnParameters(ref pos, ref vel, centre);
                        EWorm w = new EWorm(pos, vel, WormTex, 0, stats.SpawnAmountModifier + 1, null);
                        enemies.Add((Enemy)w);
                    }
                }
            }
            else
            {
                if (LevelManager.Mode != GameMode.Worms)
                {
                    if (boss == null && enemies.Count == 0)
                    {
                        SetSpawnParameters(ref pos, ref vel, centre);
                        boss = new Boss(bossTex, pos, vel);
                    }
                }
                else
                {
                    if (wBoss == null && enemies.Count == 0)
                    {
                        SetSpawnParameters(ref pos, ref vel, centre);
                        wBoss = new WormBoss(pos, vel, WBossTex, 0, (int)LevelManager.Current.BossStats.SpawnRate + 4, null);
                    }
                }
            }
        }
Esempio n. 4
0
 public WormBoss(Vector2 pos, Vector2 vel, Texture2D tex, int chainPos, int length, WormBoss Parent)
     : base(pos, vel, tex, chainPos, length, (EWorm)Parent)
 {
     stats = LevelManager.Current.BossStats;
     if (chainPos == 0)
     {
         CollisionLocation = new Vector2();
     }
     scale       = stats.Size;
     Size       *= scale;
     Life        = stats.Health;
     damageTaken = 1;
     if (chainPos == 0)
     {
         pointValue = 1000;
     }
     else
     {
         damageTaken = 0;
     }
 }