예제 #1
0
        public void Update(double deltaTime)
        {
            switch (currentCreepWave)
            {
            case CreepWave.Countdown:
                WaveCountdown(deltaTime);
                break;

            case CreepWave.Militia:
                Militia c1 = new Militia(Vector2.Zero, TextureManager.creepTexture);
                Warrior b1 = new Warrior(Vector2.Zero, TextureManager.creepTexture);
                CreateWave(deltaTime, c1, b1);
                if (waveEnded == true)
                {
                    firstWave         = false;
                    firstWaveFinished = true;
                    waveEnded         = false;
                }
                break;

            case CreepWave.Warrior:
                Warrior c2 = new Warrior(Vector2.Zero, TextureManager.creepTexture);
                Knight  b2 = new Knight(Vector2.Zero, TextureManager.creepTexture);
                CreateWave(deltaTime, c2, b2);
                if (waveEnded == true)
                {
                    secondWave         = false;
                    secondWaveFinished = true;
                    waveEnded          = false;
                }
                break;

            case CreepWave.Knight:
                Knight c3 = new Knight(Vector2.Zero, TextureManager.creepTexture);
                Lord   b3 = new Lord(Vector2.Zero, TextureManager.creepTexture);
                CreateWave(deltaTime, c3, b3);
                if (waveEnded == true)
                {
                    thirdWave         = false;
                    thirdWaveFinished = true;
                    waveEnded         = false;
                    gameWon           = true;
                }
                break;
            }

            foreach (Creep c in creepWave)
            {
                c.Update(deltaTime, path);

                if (c.texPos >= path.endT)
                {
                    creepWave.Remove(c);
                    life--;
                    break;
                }
            }
            creepWave.RemoveAll(x => x.isDead);
        }
        public void Update(double deltaTime)
        {
            switch (currentCreepWave)
            {
                case CreepWave.Countdown:
                    WaveCountdown(deltaTime);
                    break;

                case CreepWave.Militia:
                    Militia c1 = new Militia(Vector2.Zero, TextureManager.creepTexture);
                    Warrior b1 = new Warrior(Vector2.Zero, TextureManager.creepTexture);
                    CreateWave(deltaTime, c1, b1);
                    if(waveEnded == true)
                    {
                        firstWave = false;
                        firstWaveFinished = true;
                        waveEnded = false;
                    }
                    break;

                case CreepWave.Warrior:
                    Warrior c2 = new Warrior(Vector2.Zero, TextureManager.creepTexture);
                    Knight b2 = new Knight(Vector2.Zero, TextureManager.creepTexture);
                    CreateWave(deltaTime, c2, b2);
                    if(waveEnded == true)
                    {
                        secondWave = false;
                        secondWaveFinished = true;
                        waveEnded = false;
                    }
                    break;

                case CreepWave.Knight:
                    Knight c3 = new Knight(Vector2.Zero, TextureManager.creepTexture);
                    Lord b3 = new Lord(Vector2.Zero, TextureManager.creepTexture);
                    CreateWave(deltaTime, c3, b3);
                    if (waveEnded == true)
                    {
                        thirdWave = false;
                        thirdWaveFinished = true;
                        waveEnded = false;
                        gameWon = true;
                    }
                    break;
            }

            foreach (Creep c in creepWave)
            {
                c.Update(deltaTime, path);

                if (c.texPos >= path.endT)
                {
                    creepWave.Remove(c);
                    life--;
                    break;
                }
            }
            creepWave.RemoveAll(x => x.isDead);
        }