Beispiel #1
0
        public void Tank_Create()
        {
            Random rand = new Random();
            Tank   tank = new Tank();

            tank.Create();
            ManOWar.Add(tank);
            tank.koord.X = rand.Next(400, 500);
            tank.koord.Y = rand.Next(400, 500);
        }
Beispiel #2
0
        public void Infanty_Create()
        {
            Random  rand = new Random();
            Infanty inf  = new Infanty();

            inf.Create();
            ManOWar.Add(inf);
            inf.koord.X = rand.Next(400, 500);
            inf.koord.Y = rand.Next(400, 500);
        }
Beispiel #3
0
        public void Hammer_Create()
        {
            Random rand = new Random();
            Hammer ham  = new Hammer();

            ham.Create();
            ManOWar.Add(ham);
            ham.koord.X = rand.Next(400, 500);
            ham.koord.Y = rand.Next(20, 400);
        }
Beispiel #4
0
 public void KilledRemove()
 {
     for (int unit = 0; unit < alien.Count; unit++)
     {
         if (alien[unit].color == Color.Red)
         {
             alien.RemoveAt(unit);
             Game.Resource += 100;
         }
     }
     for (int unit = 0; unit < ManOWar.Count; unit++)
     {
         if (ManOWar[unit].color == Color.Red)
         {
             ManOWar.RemoveAt(unit);
             unit--;
         }
     }
 }
Beispiel #5
0
        public void SpawnRandom(Map gameMap)
        {
            bool underWater = Helper.Random.Next(2) == 0;
            int  enemyNumOW = Helper.Random.Next(3);
            int  enemyNumUW = Helper.Random.Next(3);

            if (enemyNumOW > 0 && GameController.Wave < 3)
            {
                enemyNumOW = 0;
            }
            if (enemyNumOW > 1 && GameController.Wave < 5)
            {
                enemyNumOW = 1;
            }

            if (enemyNumUW > 0 && GameController.Wave < 2)
            {
                enemyNumUW = 0;
            }
            if (enemyNumUW > 1 && GameController.Wave < 4)
            {
                enemyNumUW = 1;
            }

            Vector2 spawnLoc = FindSpawnLoc(gameMap, underWater);

            float life = 10f + (GameController.Wave * 2);

            if (underWater)
            {
                switch (enemyNumUW)
                {
                case 0:
                    Gorger gor = new Gorger(_spriteSheet, new Rectangle(0, 0, 10, 10), null, Vector2.Zero);
                    gor.Life = life;
                    gor.Spawn(spawnLoc);
                    Enemies.Add(gor);
                    break;

                case 1:
                    Lunger lun = new Lunger(_spriteSheet, new Rectangle(0, 0, 10, 10), null, Vector2.Zero);
                    lun.Life = life;
                    lun.Spawn(spawnLoc);
                    Enemies.Add(lun);
                    break;

                case 2:
                    Eyes eye = new Eyes(_spriteSheet, new Rectangle(0, 0, 10, 10), null, Vector2.Zero);
                    eye.Life = life;
                    eye.Spawn(spawnLoc);
                    Enemies.Add(eye);
                    break;
                }
            }
            else
            {
                switch (enemyNumOW)
                {
                case 0:

                    ManOWar mow = new ManOWar(_spriteSheet, new Rectangle(0, 0, 10, 10), null, Vector2.Zero);
                    mow.Life = life;
                    mow.Spawn(spawnLoc);
                    Enemies.Add(mow);
                    break;

                case 1:
                    spawnLoc = FindTileSpawnLoc(gameMap);
                    Turret tur = new Turret(_spriteSheet, new Rectangle(0, 0, 10, 10), null, Vector2.Zero);
                    tur.Life = life;
                    tur.Spawn(spawnLoc);
                    Enemies.Add(tur);
                    break;

                case 2:
                    Flyer fly = new Flyer(_spriteSheet, new Rectangle(0, 0, 10, 10), null, Vector2.Zero);
                    fly.Life = life;
                    fly.Spawn(spawnLoc);
                    Enemies.Add(fly);
                    break;
                }
            }
        }