Exemple #1
0
        void UpdateGame(float es)
        {
            UpdateHealth();
            for (int x = 0; x < 10; x++)
            {
                EntityCollection.OrderGroup(EntityCollection.entities, DrawOrder.SmallToBigY);
            }
            currentUI.HandleMouseInput(mouseMan, scenes.GetScene("text").ToVirtualPos(scenes.GetScene("game").ToVirtualPos(mouseMan.ClickPos())));
            handler.Update(es);
            EntityCollection.RecycleAll();

            gameMap.Update(es);
            UpdateHover();
            UpdateTD(es);
            UpdateTA(es);
            UpdateTS(es);

            foreach (Entity e in EntityCollection.GetGroup("enemies"))
            {
                money += e.GetValue("loot") * 1;
            }

            if (countdown)
            {
                waveTimer.Update(es);
            }
            if (waveTimer.Complete())
            {
                SendWave((int)Math.Pow(waveNumber, 2));
                waveTimer.Reset();
                money += income;
                if (money < 0)
                {
                    money = 0;
                }
            }
            if (waveAmt > 0)
            {
                if (waveAmt > 3000)
                {
                    waveAmt -= 200;
                    SpawnEnemy(3, "boss");
                }
                else if (waveAmt > 2000)
                {
                    waveAmt -= 200;
                    SpawnEnemy(1, "boss");
                }
                else if (waveAmt > 1000)
                {
                    waveAmt -= 1000;
                    SpawnEnemy(1, "boss");
                }
                else if (waveAmt > 600)
                {
                    waveAmt -= 5;
                    SpawnEnemy(1, "ballenemy");
                }
                else if (waveAmt > 400)
                {
                    waveAmt -= 20;
                    SpawnEnemy(3, "ballenemy");
                }
                else if (waveAmt > 200)
                {
                    waveAmt -= 50;
                    SpawnEnemy(4, "ballenemy");
                }
                else if (waveAmt > 150)
                {
                    waveAmt -= 20;
                    SpawnEnemy(5, "fastenemy");
                }
                else if (waveAmt > 100)
                {
                    waveAmt -= 10;
                    SpawnEnemy(5, "fatenemy");
                }
                else if (waveAmt > 70)
                {
                    waveAmt -= 5;
                    SpawnEnemy(7, "enemy1");
                }
                else if (waveAmt > 50)
                {
                    waveAmt -= 8;
                    SpawnEnemy(5, "flyenemy");
                }
                else if (waveAmt > 30)
                {
                    waveAmt -= 5;
                    SpawnEnemy(5, "enemy1");
                }
                else if (waveAmt > 15)
                {
                    waveAmt -= 5;
                    SpawnEnemy(3, "flyenemy");
                }
                else if (waveAmt > 10)
                {
                    waveAmt -= 10;
                    SpawnEnemy(1, "fatenemy");
                }
                else if (waveAmt >= 1)
                {
                    waveAmt -= 1;
                    SpawnEnemy(1, "enemy1");
                }
            }

            if (!mouseMan.Pressed() && handler.isActive)
            {
                if (currentUI.IssuedCommand("sayYes"))
                {
                    HandleEventConsequences(currentQueue[currentEventNo].outcomeIfYes);
                }
                else if (currentUI.IssuedCommand("sayNo"))
                {
                    HandleEventConsequences(currentQueue[currentEventNo].outcomeIfNo);
                }
            }
            if (handler.wasIgnored && handler.isActive)
            {
                HandleEventConsequences(currentQueue[currentEventNo].outcomeIfIgnored);
            }
            if (!handler.isActive && waitingEventQueueNbs.Count > 0)
            {
                if (waitingEventQueueNbs[0] <= 0)
                {
                    ChangeToQueue(waitingEventQueueNbs[1]);
                    waitingEventQueueNbs.RemoveAt(0);
                    waitingEventQueueNbs.RemoveAt(0);
                }
            }
        }