public static void CreateLevel(Vector2 size, PlayerSetup[] playerSetup) { List<PlayerSetup> activePlayers = new List<PlayerSetup>(); for (int i = 0; i < playerSetup.Length; i++) if (playerSetup[i].active) activePlayers.Add(playerSetup[i]); List<List<int>> map = new List<List<int>>(); int currentPlayerIndex = 0; for (int y = 0; y < (int)size.Y; y++) { map.Add(new List<int>()); for (int x = 0; x < (int)size.X; x++) { //Case 1: First Player if (x == 0 && y == 0) { currentPlayerIndex = SetupPlayerOnMap(activePlayers, map, currentPlayerIndex, y); } else if (activePlayers.Count >= 3 && x == (int)size.X - 1 && y == 0) //Case 2nd Player if 3+ Players exist { currentPlayerIndex = SetupPlayerOnMap(activePlayers, map, currentPlayerIndex, y); } else if (activePlayers.Count >= 4 && x == 0 && y == (int)size.Y - 1) //Case 4th Player if 4 Players exist { currentPlayerIndex = SetupPlayerOnMap(activePlayers, map, currentPlayerIndex, y); } else if (activePlayers.Count >= 2 && x == (int)size.X - 1 && y == (int)size.Y - 1) //Case: Final Player if 2+ Players exist { currentPlayerIndex = SetupPlayerOnMap(activePlayers, map, currentPlayerIndex, y); } else { if (PlayScreen.GameType == PlayerScreenType.Scenario) { if ((x == 20 && y == 15) || (x == 20 && y == 14) || (x == 20 && y == 13) || (x == 20 && y == 12) || (x == 20 && y == 11) || (x == 20 && y == 10) || (x == 15 && y == 10)) { map[y].Add((20000) + (activePlayers[1].playerNum * 1000) + (activePlayers[1].teamNum * 100) + 10); } else { map[y].Add(00000); } } else { map[y].Add(00000); } } } } levels.Add(new Level(0, map, activePlayers)); levels[levels.Count - 1].Load(); }
public LoadScreen(LevelType levelType, PlayerSetup[] playerTypes) : base("LoadScreen") { backgroundThread = new Thread(BackgroundWorkerThread); backgroundThreadExit = new ManualResetEvent(false); graphicsDevice = ScreenManager.Game.GraphicsDevice; this.playerTypes = playerTypes; this.levelType = levelType; }
public SinglePlayerIntroMovie() : base("SinglePlayerIntroMovie") { playerSetup = new PlayerSetup[2]; playerSetup[0] = new PlayerSetup(); playerSetup[0].type = PlayerType.Human; playerSetup[0].playerNum = 1; /////////////////////////////////////////////////////////////////////////SHOULD CHANGE TO ACTIVE PLAYER CONTROLLER? playerSetup[0].teamNum = 1; playerSetup[0].active = true; playerSetup[1] = new PlayerSetup(); playerSetup[1].type = PlayerType.AI; playerSetup[1].playerNum = 2; playerSetup[1].teamNum = 2; playerSetup[1].active = true; }
public PlayScreen(PlayerSetup[] playerSetup, PlayerScreenType gameType) : base("PlayScreen") { this.playerSetup = playerSetup; GameType = gameType; }
public override void LoadContent() { background = ScreenManager.Game.Content.Load<Texture2D>("MultiplayerLobby\\background"); activeIcons = new Texture2D[5][]; idleIcons = new Texture2D[5]; playerIconLocations = new Vector2[5]; Vector2 currentPosition = new Vector2(40, 230); Vector2 offset = new Vector2(300, 0); playerSetup = new PlayerSetup[5]; for (int i = 1; i < 5; i++) { activeIcons[i] = new Texture2D[5]; idleIcons[i] = ScreenManager.Game.Content.Load<Texture2D>("MultiplayerLobby\\mPlayer0" + i + "_idle"); for (int t = 1; t < 5; t++ ) activeIcons[i][t] = ScreenManager.Game.Content.Load<Texture2D>("MultiplayerLobby\\mSelect_player0" + i + numtoCharMapping[t]); playerIconLocations[i] = currentPosition; currentPosition += offset; playerSetup[i] = new PlayerSetup(); playerSetup[i].active = false; playerSetup[i].playerNum = i; playerSetup[i].type = PlayerType.Human; playerSetup[i].teamNum = i; } playerIndexes = new PlayerIndex[5]; playerIndexes[1] = PlayerIndex.One; playerIndexes[2] = PlayerIndex.Two; playerIndexes[3] = PlayerIndex.Three; playerIndexes[4] = PlayerIndex.Four; }