Exemplo n.º 1
0
        public static void Update()
        {
            if (!PlayerShip.Instance.IsDead && EntityManager.Count < 200)
            {
                switch (GameSessionStats.CurrentLevel)
                {
                case 1:     //Level 1
                    GameSessionStats.NumberOfKillsRequired = 20;

                    if (ProgressToNextLevel())
                    {
                        break;
                    }

                    if (LevelSpawnCapReached())
                    {
                        break;
                    }

                    if (rand.Next((int)governmentSeekerSpawnChance) == 0)
                    {
                        EntityManager.Add(Enemy.CreateGovernmentSeeker(GetSpawnPosition()));
                        ++GameSessionStats.TotalEnemiesSpawnedInLevel;
                    }

                    break;

                case 2:    //Level 2
                    GameSessionStats.NumberOfKillsRequired = 30;

                    if (ProgressToNextLevel())
                    {
                        break;
                    }

                    if (LevelSpawnCapReached())
                    {
                        break;
                    }

                    if (rand.Next((int)governmentSeekerSpawnChance * 2) == 0)
                    {
                        EntityManager.Add(Enemy.CreateGovernmentSeeker(GetSpawnPosition()));
                        ++GameSessionStats.TotalEnemiesSpawnedInLevel;
                    }

                    if (rand.Next((int)pirateSeekerSpawnChance * 2) == 0)
                    {
                        EntityManager.Add(Enemy.CreatePirateSeeker(GetSpawnPosition()));
                        ++GameSessionStats.TotalEnemiesSpawnedInLevel;
                    }


                    break;

                case 3:                                       //Level 3

                    if (GameSessionStats.BossStatus == false) //Ensure only one boss is spawned
                    {
                        EntityManager.Add(Enemy.CreateGovernmentBoss(GetSpawnPosition()));
                        GameSessionStats.BossStatus = true;
                    }

                    if (GameSessionStats.BossKilled == true)
                    {
                        GameRoot.ResetGameSession();
                        GameSessionStats.CurrentLevel = 1;
                    }


                    if (rand.Next((int)pirateSeekerSpawnChance) == 0)
                    {
                        EntityManager.Add(Enemy.CreatePirateSeeker(GetSpawnPosition()));
                    }


                    break;
                }
            }
        }