예제 #1
0
        public FreeForAll(Color[] colors, string mapString, float gravity, int minutes, int lives, float limbStrength, bool suddenDeath, bool traps, bool longRange, bool bots)
        {
            world = new World(new Vector2(0, gravity));

            MapData data = Map.LoadMap(world, mapString);
            background = data.background;
            walls = data.walls;
            spawnPoints = data.spawnPoints;
            Vector3[] ammoPoints = data.ammoPoints;
            ammo = new TrapAmmo[ammoPoints.Length];
            if (traps)
                for (int i = 0; i < ammoPoints.Length; i++)
                    ammo[i] = new TrapAmmo(world, new Vector2(ammoPoints[i].X, ammoPoints[i].Y) * MainGame.PIXEL_TO_METER, (int)ammoPoints[i].Z);
            music = data.music;
            MediaPlayer.Play(music);
            foreground = data.foreground;

            StickFigure.AllowTraps = traps;
            StickFigure.AllowLongRange = longRange;

            player = new StickFigure[bots ? 4 : colors.Length];
            this.info = new PlayerValues[bots ? 4 : colors.Length];

            for (int i = 0; i < colors.Length; i++)
                if (colors[i] != null)
                {
                    player[i] = new LocalPlayer(world, spawnPoints[i] * MainGame.PIXEL_TO_METER, Categories[i], 1.5f, limbStrength, suddenDeath ? 0.001f : 1f, false, colors[i], Players[i]);
                    player[i].LockControl = true;
                }

            if (bots && colors.Length < 4)
            {
                for (int i = colors.Length; i < 4; i++)
                {
                    player[i] = new BotPlayer(world, spawnPoints[i] * MainGame.PIXEL_TO_METER, Categories[i], 1.5f, limbStrength, suddenDeath ? 0.001f : 1f, false, new Color(i * 60, i * 60, i * 60), Players[i], player);
                    player[i].LockControl = true;
                }
            }

            for (int i = 0; i < info.Length; i++)
                info[i] = new PlayerValues(lives);

            timed = minutes > 0;
            millisLeft = (minutes == 0 ? -1 : minutes * 60000);
            startPause = 180;
            gameOver = false;
            winners = new List<int>();
            winSticks = new List<StickFigure>();
            enterPressed = true;
        }
        public TeamDeathmatch(Color[] colors, string mapString, float gravity, int minutes, int lives, float limbStrength, bool suddenDeath, bool traps, bool longRange, bool bots)
        {
            world = new World(new Vector2(0, gravity));

            object[] map = Map.LoadMap(world, mapString);
            background = (Texture2D)map[0];
            walls = (List<Wall>)map[1];
            spawnPoints = (Vector2[])map[2];
            Vector3[] ammoPoints = (Vector3[])map[3];
            ammo = new TrapAmmo[ammoPoints.Length];
            if (traps)
                for (int i = 0; i < ammoPoints.Length; i++)
                    ammo[i] = new TrapAmmo(world, new Vector2(ammoPoints[i].X, ammoPoints[i].Y) * MainGame.PIXEL_TO_METER, (int)ammoPoints[i].Z);

            StickFigure.AllowTraps = traps;
            StickFigure.AllowLongRange = longRange;

            player = new StickFigure[bots ? 4 : colors.Length];
            this.info = new PlayerValues[bots ? 4 : colors.Length];

            for (int i = 0; i < colors.Length; i++)
                if (colors[i] != null)
                {
                    player[i] = new LocalPlayer(world, spawnPoints[i] * MainGame.PIXEL_TO_METER, Categories[i], 1.5f, limbStrength, suddenDeath ? 0.001f : 1f, i % 2 == 1, colors[i], Players[i]);
                    player[i].LockControl = true;
                }

            if (bots && colors.Length < 4)
            {
                for (int i = colors.Length; i < 4; i++)
                {
                    player[i] = new BotPlayer(world, spawnPoints[i] * MainGame.PIXEL_TO_METER, Categories[i], 1.5f, limbStrength, suddenDeath ? 0.001f : 1f, i % 2 == 1, new Color(i * 60, i * 60, i * 60), Players[i], player);
                    player[i].LockControl = true;
                }
            }

            for (int i = 0; i < info.Length; i++)
                info[i] = new PlayerValues(lives);

            timed = minutes > 0;
            millisLeft = (minutes == 0 ? -1 : minutes * 60000);
            startPause = 180;
            gameOver = false;
            winners = new List<int>();
            winSticks = new List<StickFigure>();
        }