Example #1
0
        public void UpdateLevel(int level, TinyHuman[] tinyHumans, House[] Houses, GameMap Map, out int humansToKill)
        {
            humansToKill = 20;

            if (level == 1)
            {
                int c;
                for (c = 0; c < 20; c++)
                {
                    tinyHumans[c].active = true;
                    tinyHumans[c].dead = false;
                    tinyHumans[c].type = (TinyHumanType)game.rnd.Next(4);
                    tinyHumans[c].pos = new Vector2(game.rnd.Next(40), game.rnd.Next(28));
                }

                tinyHumans[21].active = true;
                tinyHumans[21].type = TinyHumanType.Cat;

                for (c = 0; c < 5; c++)
                {
                    Houses[c].active = true;
                    //tinyHumans[c].dead = false;
                    Houses[c].type = HouseType.Mormorshus;
                }

                humansToKill = 20;
            }
            else if (level == 2)
            {
                int c;
                for (c = 0; c < 20; c++)
                {
                    tinyHumans[c].active = true;
                    tinyHumans[c].dead = false;
                    tinyHumans[c].type = (TinyHumanType)game.rnd.Next(4);
                    tinyHumans[c].pos = new Vector2(game.rnd.Next(40), game.rnd.Next(28));
                }

                for (c = 20; c < 40; c++)
                {
                    tinyHumans[c].active = true;
                    tinyHumans[c].dead = false;
                    tinyHumans[c].type = TinyHumanType.Soldier;
                    tinyHumans[c].pos = new Vector2(game.rnd.Next(20) + 20, game.rnd.Next(28));

                    tinyHumans[c].actionSpan = TimeSpan.FromSeconds(5);
                }

                humansToKill = 40;

                for (c = 0; c < 10; c++)
                {
                    Houses[c].active = true;
                    Houses[c].type = HouseType.Mormorshus;
                }
            }
            else
            {
                int c;
                for (c = 0; c < 20; c++)
                {
                    tinyHumans[c].active = true;
                    tinyHumans[c].dead = false;
                    tinyHumans[c].type = (TinyHumanType)game.rnd.Next(4);
                    tinyHumans[c].pos = new Vector2(game.rnd.Next(40), game.rnd.Next(28));
                }

                for (c = 20; c < 40; c++)
                {
                    tinyHumans[c].active = true;
                    tinyHumans[c].dead = false;
                    tinyHumans[c].type = TinyHumanType.Soldier;
                    tinyHumans[c].pos = new Vector2(game.rnd.Next(20)+20, game.rnd.Next(28));

                    tinyHumans[c].actionSpan = TimeSpan.FromSeconds(game.rnd.Next(3)+2);

                }

                humansToKill = 40;

                for (c = 0; c < 10; c++)
                {
                    Houses[c].active = false;
                }

                Houses[0].active = true;
                Houses[0].destroyed = false;
                Houses[0].type = HouseType.Whitehouse1;
                Houses[0].pos.X = 20;
                Houses[0].pos.Y = 5;

                Houses[1].active = true;
                Houses[1].destroyed = false;
                Houses[1].type = HouseType.Whitehouse2;
                Houses[1].pos.X = 22;
                Houses[1].pos.Y = 5;

                Houses[2].active = true;
                Houses[2].destroyed = false;
                Houses[2].type = HouseType.Whitehouse3;
                Houses[2].pos.X = 24;
                Houses[2].pos.Y = 5;

            }
        }
Example #2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            rnd = new Random();
            maxx = 39;
            maxy = 23;

            Map = new GameMap(this, 300, 200);
            player = new Player(this);
            levels = new Levels(this);

            tinyHumans = new TinyHuman[MAXHUMAN];
            Houses = new House[MAXHOUSE];

            int c;
            for (c = 0; c < MAXHUMAN; c++)
            {
                tinyHumans[c] = new TinyHuman(this);
                tinyHumans[c].active = false;
            }

            for (c = 0; c < MAXHOUSE; c++)
            {
                Houses[c] = new House(this);
                Houses[c].active = false;
            }

            Components.Add(player);
            //graphics.IsFullScreen = true;
            //graphics.ApplyChanges();

            showGameOver = false;
            gameOverScreenTime = TimeSpan.FromSeconds(5);

            life = 100;
            endgame = 0;

            level = 1;
            levels.UpdateLevel(level, tinyHumans, Houses, Map, out humansToKill);
        }