private void ProcessInput() { foreach (Player player in Space394Game.GameInstance.Controllers) { if (InputManager.isCombinedSuperConfirmPressed(player.PlayerNumber)) { if (!Space394Game.GameInstance.Players.Contains(player)) { Space394Game.GameInstance.increasePlayers((int)player.PlayerNumber); } else { } } else if (InputManager.isCombinedUnconfirmPressed(player.PlayerNumber)) { if (Space394Game.GameInstance.Players.Contains(player)) { if (!readys[player.ScreenIndex]) { Space394Game.GameInstance.decreasePlayers((int)player.PlayerNumber); } else { } } else { } } else { } } foreach (Player player in Space394Game.GameInstance.Players) { if (InputManager.isCombinedConfirmPressed(player.PlayerNumber) || InputManager.isCombinedSuperConfirmPressed(player.PlayerNumber) || InputManager.isCombinedPrimaryFirePressed(player.PlayerNumber)) { if (!justJoined[player.ScreenIndex]) { readys[player.ScreenIndex] = true; } else { } } else if (InputManager.isCombinedUnconfirmPressed(player.PlayerNumber)) { readys[player.ScreenIndex] = false; } else { } } if (!everyoneReady) { delay = DELAY; } else { } if (Space394Game.GameInstance.Players.Count > 0 && Space394Game.GameInstance.Players.Count == readys.Count) { everyoneReady = true; foreach (bool readiness in readys) { if (!readiness) { everyoneReady = false; break; } else { } } } else { } for (int i = 0; i < justJoined.Count; i++) { justJoined[i] = false; } if (InputManager.isQuitKeyPressed()) { readyToExit = true; nextScene = Space394Game.sceneEnum.MainMenuScene; foreach (Player player in Space394Game.GameInstance.Controllers) { player.CurrentState = new MenuPlayerState(player); } } else { } }
private void UpdateSkirmish(float deltaTime) { foreach (Player player in Space394Game.GameInstance.Controllers) { if (InputManager.isCombinedDownCombinedStickPressed(player.PlayerNumber)) { switch (currentSkirmishSelect) { case skirmishSelect.engagement: currentSkirmishSelect = skirmishSelect.contention; break; case skirmishSelect.contention: currentSkirmishSelect = skirmishSelect.dissidence; break; case skirmishSelect.dissidence: currentSkirmishSelect = skirmishSelect.engagement; break; } } else if (InputManager.isCombinedUpCombinedStickPressed(player.PlayerNumber)) { switch (currentSkirmishSelect) { case skirmishSelect.engagement: currentSkirmishSelect = skirmishSelect.dissidence; break; case skirmishSelect.contention: currentSkirmishSelect = skirmishSelect.engagement; break; case skirmishSelect.dissidence: currentSkirmishSelect = skirmishSelect.contention; break; } } else { } } if (InputManager.isConfirmationKeyPressed() || InputManager.isSuperConfirmationKeyPressed()) { switch (currentSkirmishSelect) { case skirmishSelect.engagement: LoadingScene.MapToLoad = "SampleSmall"; break; case skirmishSelect.contention: LoadingScene.MapToLoad = "SampleMedium"; break; case skirmishSelect.dissidence: LoadingScene.MapToLoad = "Sample"; break; default: // Just in case LoadingScene.MapToLoad = "SampleSmall"; break; } nextScene = Space394Game.sceneEnum.PlayerSelectScene; readyToExit = true; foreach (Player player in Space394Game.GameInstance.Controllers) { player.nextState(); } } else if (InputManager.isUnconfirmationKeyPressed()) { currentState = state.main; currentSkirmishSelect = skirmishSelect.engagement; } else { } }
public override void Initialize() { textPosition = new Vector2(100, 400); stars = ContentLoadManager.loadTexture("Textures/Screens/stars_background_alt"); background = ContentLoadManager.loadTexture("Textures/Screens/player_start_grid"); Texture2D pressStartToJoinTexture = ContentLoadManager.loadTexture("Textures/Screens/text_start_to_join"); Texture2D pressConfirmWhenReadyTexture = ContentLoadManager.loadTexture("Textures/Screens/text_a_when_ready"); Texture2D readyTexture = ContentLoadManager.loadTexture("Textures/Screens/text_ready"); Texture2D pressStartToBeginTexture = ContentLoadManager.loadTexture("Textures/Screens/text_start_match"); int width = pressStartToJoinTexture.Width / 2; joinTextPositions = new Vector2[] { new Vector2(200-width, 100), new Vector2(600-width, 100), new Vector2(200-width, 340), new Vector2(600-width, 340) }; width = pressConfirmWhenReadyTexture.Width / 2; pressReadyTextPositions = new Vector2[] { new Vector2(200-width, 50), new Vector2(600-width, 50), new Vector2(200-width, 290), new Vector2(600-width, 290) }; width = readyTexture.Width / 2; readyTextPositions = new Vector2[] { new Vector2(200-width, 50), new Vector2(600-width, 50), new Vector2(200-width, 290), new Vector2(600-width, 290) }; pressStartToBeginPosition = new Vector2(400 - pressStartToBeginTexture.Width / 2, 240 - pressStartToBeginTexture.Height / 2); pressStartToJoin = new AutoTexture2D(pressStartToJoinTexture, joinTextPositions[0]); pressConfirmWhenReady = new AutoTexture2D(pressConfirmWhenReadyTexture, pressReadyTextPositions[0]); ready = new AutoTexture2D(readyTexture, readyTextPositions[0]); pressStartToBegin = new AutoTexture2D(pressStartToBeginTexture, pressStartToBeginPosition); controller1 = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/xbox_player_1_icon"), Vector2.Zero); controller2 = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/xbox_player_2_icon"), Vector2.Zero); controller3 = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/xbox_player_3_icon"), Vector2.Zero); controller4 = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/xbox_player_4_icon"), Vector2.Zero); keyboard = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/keyboard_icon"), Vector2.Zero); font = Space394Game.GameInstance.Content.Load<SpriteFont>("Fonts\\DefaultFont"); nextScene = Space394Game.sceneEnum.LoadingScene; controllerPositions = new Vector2[] { new Vector2(200, 135), new Vector2(600, 135), new Vector2(200, 375), new Vector2(600, 375) }; base.Initialize(); /*for (int i = 0; i < Space394Game.GameInstance.Controllers.Length-2; i++) { Space394Game.GameInstance.increasePlayers((int)Space394Game.GameInstance.Controllers[i].PlayerNumber); readyToExit = true; }*/ }
private void UpdateExtras(float deltaTime) { foreach (Player player in Space394Game.GameInstance.Controllers) { if (InputManager.isCombinedDownCombinedStickPressed(player.PlayerNumber)) { switch (currentExtrasSelect) { case extrasSelect.credits: currentExtrasSelect = extrasSelect.credits; break; } } else if (InputManager.isCombinedUpCombinedStickPressed(player.PlayerNumber)) { switch (currentExtrasSelect) { case extrasSelect.credits: currentExtrasSelect = extrasSelect.credits; break; } } else { } } if (InputManager.isConfirmationKeyPressed() || InputManager.isSuperConfirmationKeyPressed()) { switch (currentExtrasSelect) { case extrasSelect.credits: nextScene = Space394Game.sceneEnum.CreditsScene; break; } readyToExit = true; } else if (InputManager.isUnconfirmationKeyPressed()) { currentState = state.main; currentExtrasSelect = extrasSelect.credits; } else { } }