private void Update() { //UP if (victoryUI.activeSelf) { if ((InputSystem.DPadDown(DPad.Down, 0) || InputSystem.ThumbstickInput(ThumbSticks.LeftY, 0) < 0) && !pressed) { pressed = true; index++; if (index >= victoryButtons.Length) { index = 0; } victoryButtons[index].Select(); } //Down if ((InputSystem.DPadDown(DPad.Up, 0) && index > 0 || InputSystem.ThumbstickInput(ThumbSticks.LeftY, 0) > 0) && !pressed) { pressed = true; index--; if (index < 0) { index = victoryButtons.Length - 1; } victoryButtons[index].Select(); } if (InputSystem.ThumbstickInput(ThumbSticks.LeftY, 0) == 0 && pressed) { pressed = false; } } if (InputSystem.ButtonDown(Buttons.A, 0) && victoryUI.activeSelf) { victoryButtons[index].onClick.Invoke(); } }
void Update() { //Beta Lobby Pause if (currentScene.name == "Lobby" && pauseCanvasLobby.activeSelf) { //UP if ((InputSystem.DPadDown(DPad.Down, 0) || InputSystem.ThumbstickInput(ThumbSticks.LeftY, 0) < 0) && !pressed) { pressed = true; index++; if (index >= buttonsLobby.Length) { index = 0; } buttonsLobby[index].Select(); } //Down if ((InputSystem.DPadDown(DPad.Up, 0) && index > 0 || InputSystem.ThumbstickInput(ThumbSticks.LeftY, 0) > 0) && !pressed) { pressed = true; index--; if (index < 0) { index = buttonsLobby.Length - 1; } buttonsLobby[index].Select(); } if (InputSystem.ThumbstickInput(ThumbSticks.LeftY, 0) == 0 && pressed) { pressed = false; } } //Press Start in Beta Lobby to open Pause Menu if (InputSystem.ButtonDown(Buttons.Start, 0) && currentScene.name == "Lobby") { pauseCanvasLobby.SetActive(true); EventSystem.current.SetSelectedGameObject(null); index = 0; buttonsLobby[index].Select(); //GameManager.instance.PauseGame(true); Time.timeScale = 0.000001f; } if (currentScene.name == "Lobby" && pauseCanvasLobby.activeSelf == false) { Time.timeScale = 1; } if (currentScene.name != "Lobby") { //UP if ((InputSystem.DPadDown(DPad.Down, 0) || InputSystem.ThumbstickInput(ThumbSticks.LeftY, 0) < 0) && !pressed) { pressed = true; index++; if (index >= buttonsGame.Length) { index = 0; } buttonsGame[index].Select(); } //Down if ((InputSystem.DPadDown(DPad.Up, 0) && index > 0 || InputSystem.ThumbstickInput(ThumbSticks.LeftY, 0) > 0) && !pressed) { pressed = true; index--; if (index < 0) { index = buttonsGame.Length - 1; } buttonsGame[index].Select(); } if (InputSystem.ThumbstickInput(ThumbSticks.LeftY, 0) == 0 && pressed) { pressed = false; } } //Press Start while Ingame if (InputSystem.ButtonDown(Buttons.Start, 0) && currentScene.name != "Lobby") { pauseCanvasGame.SetActive(true); EventSystem.current.SetSelectedGameObject(null); index = 0; buttonsGame[index].Select(); //GameManager.instance.PauseGame(true); Time.timeScale = 0.000001f; GamePad.SetVibration(PlayerIndex.One, 0, 0); GamePad.SetVibration(PlayerIndex.Two, 0, 0); GamePad.SetVibration(PlayerIndex.Three, 0, 0); GamePad.SetVibration(PlayerIndex.Four, 0, 0); } if (pauseCanvasGame.activeSelf || pauseCanvasLobby.activeSelf) { //Buttons for Lobby if (InputSystem.ButtonDown(Buttons.A, 0) && pauseCanvasLobby.activeSelf) { buttonsLobby[index].onClick.Invoke(); } //Buttons for Game if (InputSystem.ButtonDown(Buttons.A, 0) && pauseCanvasGame.activeSelf) { buttonsGame[index].onClick.Invoke(); } } }
private void Update() { if (ready) { if (InputSystem.ButtonDown(Buttons.B, playerNr - 1) || !InputSystem.PadConnected(playerNr - 1)) { ready = false; GameManager.instance.RemovePlayer(playerNr); PlanetSelectionManager.instance.Unready(); readyText.SetActive(false); readyButton.SetActive(true); } return; } if (!joined && InputSystem.ButtonDown(Buttons.A, playerNr - 1)) { joined = true; characters[index].SetActive(true); PlanetSelectionManager.instance.JoinGame(); joinText.SetActive(false); readyButton.SetActive(true); } else if (joined) { if (InputSystem.ButtonDown(Buttons.A, playerNr - 1)) { ready = true; GameManager.instance.SetPlayer(index, playerNr); PlanetSelectionManager.instance.Ready(); readyButton.SetActive(false); readyText.SetActive(true); return; } else if (InputSystem.ButtonDown(Buttons.B, playerNr - 1) || !InputSystem.PadConnected(playerNr - 1)) { joined = false; PlanetSelectionManager.instance.LeaveGame(); characters[index].SetActive(false); readyButton.SetActive(false); joinText.SetActive(true); return; } if (InputSystem.DPadDown(DPad.Right, playerNr - 1) || InputSystem.ThumbstickInput(ThumbSticks.LeftX, playerNr - 1) > 0 && !pressed) { pressed = true; characters[index].SetActive(false); index++; if (index >= characters.Length) { index = 0; } characters[index].SetActive(true); } else if (InputSystem.DPadDown(DPad.Left, playerNr - 1) || InputSystem.ThumbstickInput(ThumbSticks.LeftX, playerNr - 1) < 0 && !pressed) { pressed = true; characters[index].SetActive(false); index--; if (index < 0) { index = characters.Length - 1; } characters[index].SetActive(true); } if (InputSystem.ThumbstickInput(ThumbSticks.LeftX, playerNr - 1) == 0 && pressed) { pressed = false; } } }