void Awake() { controller = new ControllerControls(); controller.Main.Fire.performed += ctx => Shoot(); controller.Main.Fire.canceled += ctx => ShootStop(); controller.Main.rLeft.performed += ctx => RotateLeft(); controller.Main.rRight.performed += ctx => RotateRight(); controller.Main.AirGun.performed += ctx => AirShot(); controller.Main.rLeft.canceled += ctx => RotateStop(); controller.Main.rRight.canceled += ctx => RotateStop(); }
/// <summary> /// Allow the player to move around in the scene /// </summary> void PlayerMovement() { switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.JoystickLeft(Player)) { RB.velocity = Vector2.left * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.left); } if (ArcadeControls.JoystickRight(Player)) { RB.velocity = Vector2.right * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.right); } if (ArcadeControls.JoystickUp(Player)) { RB.velocity = Vector2.up * MoveSpd * Time.deltaTime; //UpdateGunshipDirection(Vector2.up); } if (ArcadeControls.JoystickDown(Player)) { RB.velocity = Vector2.down * MoveSpd * Time.deltaTime; //UpdateGunshipDirection(Vector2.down); } if (ArcadeControls.JoystickNorthEast(Player)) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f)); } if (ArcadeControls.JoystickNorthWest(Player)) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f)); } if (ArcadeControls.JoystickSouthEast(Player)) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f)); } if (ArcadeControls.JoystickSouthWest(Player)) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f)); } if (ArcadeControls.JoystickNone(Player)) { RB.velocity = Vector2.zero; } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ControllerLeft(ConvertToPlayers())) { RB.velocity = Vector2.left * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.left); } if (ControllerControls.ControllerRight(ConvertToPlayers())) { RB.velocity = Vector2.right * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.right); } if (ControllerControls.ControllerUp(ConvertToPlayers())) { RB.velocity = Vector2.up * MoveSpd * Time.deltaTime; //UpdateGunshipDirection(Vector2.up); } if (ControllerControls.ControllerDown(ConvertToPlayers())) { RB.velocity = Vector2.down * MoveSpd * Time.deltaTime; //UpdateGunshipDirection(Vector2.down); } if (ControllerControls.ControllerLeftUp(ConvertToPlayers())) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f)); } if (ControllerControls.ControllerRightUp(ConvertToPlayers())) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f)); } if (ControllerControls.ControllerLeftDown(ConvertToPlayers())) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f)); } if (ControllerControls.ControllerRightDown(ConvertToPlayers())) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f)); } if (ControllerControls.ControllerNone(ConvertToPlayers())) { RB.velocity = Vector2.zero; } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.KeyboardLeft(ConvertToPlayers())) { RB.velocity = Vector2.left * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.left); } if (KeyboardControls.KeyboardRight(ConvertToPlayers())) { RB.velocity = Vector2.right * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.right); } if (KeyboardControls.KeyboardUp(ConvertToPlayers())) { RB.velocity = Vector2.up * MoveSpd * Time.deltaTime; // UpdateGunshipDirection(Vector2.up); } if (KeyboardControls.KeyboardDown(ConvertToPlayers())) { RB.velocity = Vector2.down * MoveSpd * Time.deltaTime; //UpdateGunshipDirection(Vector2.down); } if (KeyboardControls.KeyboardLeftUp(ConvertToPlayers())) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f)); } if (KeyboardControls.KeyboardRightUp(ConvertToPlayers())) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f)); } if (KeyboardControls.KeyboardLeftDown(ConvertToPlayers())) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f)); } if (KeyboardControls.KeyboardRightDown(ConvertToPlayers())) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f)); } if (KeyboardControls.KeyboardNone(ConvertToPlayers())) { RB.velocity = Vector2.zero; } break; case SupportedControllers.KeyboardP1ControllerP2: if (ConvertToPlayers() == Players.P1) { if (KeyboardControls.KeyboardLeft(Players.P1)) { RB.velocity = Vector2.left * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.left); } if (KeyboardControls.KeyboardRight(Players.P1)) { RB.velocity = Vector2.right * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.right); } if (KeyboardControls.KeyboardUp(Players.P1)) { RB.velocity = Vector2.up * MoveSpd * Time.deltaTime; //UpdateGunshipDirection(Vector2.up); } if (KeyboardControls.KeyboardDown(Players.P1)) { RB.velocity = Vector2.down * MoveSpd * Time.deltaTime; //UpdateGunshipDirection(Vector2.down); } if (KeyboardControls.KeyboardLeftUp(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f)); } if (KeyboardControls.KeyboardRightUp(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f)); } if (KeyboardControls.KeyboardLeftDown(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f)); } if (KeyboardControls.KeyboardRightDown(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f)); } if (KeyboardControls.KeyboardNone(Players.P1)) { RB.velocity = Vector2.zero; } } else { if (ControllerControls.ControllerLeft(Players.P1)) { RB.velocity = Vector2.left * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.left); } if (ControllerControls.ControllerRight(Players.P1)) { RB.velocity = Vector2.right * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.right); } if (ControllerControls.ControllerUp(Players.P1)) { RB.velocity = Vector2.up * MoveSpd * Time.deltaTime; //UpdateGunshipDirection(Vector2.up); } if (ControllerControls.ControllerDown(Players.P1)) { RB.velocity = Vector2.down * MoveSpd * Time.deltaTime; //UpdateGunshipDirection(Vector2.down); } if (ControllerControls.ControllerLeftUp(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f)); } if (ControllerControls.ControllerRightUp(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f)); } if (ControllerControls.ControllerLeftDown(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f)); } if (ControllerControls.ControllerRightDown(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f)); } if (ControllerControls.ControllerNone(Players.P1)) { RB.velocity = Vector2.zero; } } break; case SupportedControllers.KeyboardP2ControllerP1: if (ConvertToPlayers() == Players.P2) { if (KeyboardControls.KeyboardLeft(Players.P1)) { RB.velocity = Vector2.left * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.left); } if (KeyboardControls.KeyboardRight(Players.P1)) { RB.velocity = Vector2.right * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.right); } if (KeyboardControls.KeyboardUp(Players.P1)) { RB.velocity = Vector2.up * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.up); } if (KeyboardControls.KeyboardDown(Players.P1)) { RB.velocity = Vector2.down * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.down); } if (KeyboardControls.KeyboardLeftUp(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f)); } if (KeyboardControls.KeyboardRightUp(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f)); } if (KeyboardControls.KeyboardLeftDown(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f)); } if (KeyboardControls.KeyboardRightDown(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f)); } if (KeyboardControls.KeyboardNone(Players.P1)) { RB.velocity = Vector2.zero; } } else { if (ControllerControls.ControllerLeft(Players.P1)) { RB.velocity = Vector2.left * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.left); } if (ControllerControls.ControllerRight(Players.P1)) { RB.velocity = Vector2.right * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.right); } if (ControllerControls.ControllerUp(Players.P1)) { RB.velocity = Vector2.up * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.up); } if (ControllerControls.ControllerDown(Players.P1)) { RB.velocity = Vector2.down * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.down); } if (ControllerControls.ControllerLeftUp(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f)); } if (ControllerControls.ControllerRightUp(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f)); } if (ControllerControls.ControllerLeftDown(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f)); } if (ControllerControls.ControllerRightDown(Players.P1)) { RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime; UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f)); } if (ControllerControls.ControllerNone(Players.P1)) { RB.velocity = Vector2.zero; } } break; default: break; } }
private new void Update() { if (currentScreen == Screens.Input) { if (P1Ready && P2Ready /*&& (!string.IsNullOrEmpty(keyboards[0].InputtedValue)) && (!string.IsNullOrEmpty(keyboards[1].InputtedValue))*/) { if (Confirm()) { loadedData = SaveManager.LoadOperationStarshine(); changeToLeaderboard = true; } } // Keyboard backlights and confirming switch (ControllerType) { case SupportedControllers.ArcadeBoard: // Player 1 if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8) && (!P1Ready)) { P1Ready = true; keyboards[0].enabled = false; keyboards[0].GetComponentsInChildren <Image>()[0].color = confirmCol; } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7) && (P1Ready)) { P1Ready = false; keyboards[0].enabled = true; keyboards[0].ShowSelected(); keyboards[0].GetComponentsInChildren <Image>()[0].color = P1PreviousCol; } // Player 2 if (ArcadeControls.ButtonPress(Joysticks.Black, Buttons.B8) && (!P2Ready)) { P2Ready = true; keyboards[1].enabled = false; keyboards[1].GetComponentsInChildren <Image>()[0].color = confirmCol; } if (ArcadeControls.ButtonPress(Joysticks.Black, Buttons.B7) && (P2Ready)) { P2Ready = false; keyboards[1].enabled = true; keyboards[1].ShowSelected(); keyboards[1].GetComponentsInChildren <Image>()[0].color = P2PreviousCol; } break; case SupportedControllers.GamePadBoth: // Player 1 if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm) && (!P1Ready)) { P1Ready = true; keyboards[0].enabled = false; keyboards[0].GetComponentsInChildren <Image>()[0].color = confirmCol; } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Return) && (P1Ready)) { P1Ready = false; keyboards[0].enabled = true; keyboards[0].ShowSelected(); keyboards[0].GetComponentsInChildren <Image>()[0].color = P1PreviousCol; } // Player 2 if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Confirm) && (!P2Ready)) { P2Ready = true; keyboards[1].enabled = false; keyboards[1].GetComponentsInChildren <Image>()[0].color = confirmCol; } if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Return) && (P2Ready)) { P2Ready = false; keyboards[1].enabled = true; keyboards[1].ShowSelected(); keyboards[1].GetComponentsInChildren <Image>()[0].color = P2PreviousCol; } break; case SupportedControllers.KeyboardBoth: // Player 1 if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8) && (!P1Ready)) { P1Ready = true; keyboards[0].enabled = false; keyboards[0].GetComponentsInChildren <Image>()[0].color = confirmCol; } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7) && (P1Ready)) { P1Ready = false; keyboards[0].enabled = true; keyboards[0].ShowSelected(); keyboards[0].GetComponentsInChildren <Image>()[0].color = P1PreviousCol; } // Player 2 if (KeyboardControls.ButtonPress(Players.P2, Buttons.B8) && (!P2Ready)) { P2Ready = true; keyboards[1].enabled = false; keyboards[1].GetComponentsInChildren <Image>()[0].color = confirmCol; } if (KeyboardControls.ButtonPress(Players.P2, Buttons.B7) && (P2Ready)) { P2Ready = false; keyboards[1].enabled = true; keyboards[1].ShowSelected(); keyboards[1].GetComponentsInChildren <Image>()[0].color = P2PreviousCol; } break; case SupportedControllers.KeyboardP1ControllerP2: // Player 1 if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8) && (!P1Ready)) { P1Ready = true; keyboards[0].enabled = false; keyboards[0].GetComponentsInChildren <Image>()[0].color = confirmCol; } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7) && (P1Ready)) { P1Ready = false; keyboards[0].enabled = true; keyboards[0].ShowSelected(); keyboards[0].GetComponentsInChildren <Image>()[0].color = P1PreviousCol; } // Player 2 if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Confirm) && (!P2Ready)) { P2Ready = true; keyboards[1].enabled = false; keyboards[1].GetComponentsInChildren <Image>()[0].color = confirmCol; } if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Return) && (P2Ready)) { P2Ready = false; keyboards[1].enabled = true; keyboards[1].ShowSelected(); keyboards[1].GetComponentsInChildren <Image>()[0].color = P2PreviousCol; } break; case SupportedControllers.KeyboardP2ControllerP1: // Player 1 if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm) && (!P1Ready)) { P1Ready = true; keyboards[0].enabled = false; keyboards[0].GetComponentsInChildren <Image>()[0].color = confirmCol; } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Return) && (P1Ready)) { P1Ready = false; keyboards[0].enabled = true; keyboards[0].ShowSelected(); keyboards[0].GetComponentsInChildren <Image>()[0].color = P1PreviousCol; } // Player 2 if (KeyboardControls.ButtonPress(Players.P2, Buttons.B8) && (!P2Ready)) { P2Ready = true; keyboards[1].enabled = false; keyboards[1].GetComponentsInChildren <Image>()[0].color = confirmCol; } if (KeyboardControls.ButtonPress(Players.P2, Buttons.B7) && (P2Ready)) { P2Ready = false; keyboards[1].enabled = true; keyboards[1].ShowSelected(); keyboards[1].GetComponentsInChildren <Image>()[0].color = P2PreviousCol; } break; default: break; } // if move screen - do canvas grouip fades if ((changeToLeaderboard) && (canvasGroups[0].alpha != 0) && (canvasGroups[1].alpha != 1)) { canvasGroups[0].alpha -= 2 * Time.deltaTime; canvasGroups[1].alpha += 2 * Time.deltaTime; if (canvasGroups[0].alpha == 0 && canvasGroups[1].alpha == 1) { if (keyboards[0].GetFinalValue() != null) { leaderboardData.Player1Name = keyboards[0].GetFinalValue(); } else { leaderboardData.Player1Name = "Unknown"; } if (keyboards[1].GetFinalValue() != null) { leaderboardData.Player2Name = keyboards[1].GetFinalValue(); } else { leaderboardData.Player2Name = "Unknown"; } leaderboardData.Player1Score = loadedData.Player1Score; leaderboardData.Player2Score = loadedData.Player2Score; leaderboardData.Player1ShipName = ConvertToShipName(loadedData.LastPlayer1ShipSelection); leaderboardData.Player2ShipName = ConvertToShipName(loadedData.LastPlayer2ShipSelection); if (ControllerType == SupportedControllers.ArcadeBoard) { leaderboardData.Platform = "Arcade"; } else { leaderboardData.Platform = "PC"; } isLeaderboardScreen = true; currentScreen = Screens.Leaderboard; sendScript.SendDataToBoard(leaderboardData); UpdateStatsScreen(); } } } else { MoveUD(); UpdateMenuOptions(); UpdateStatsScreen(); if (isLeaderboardScreen) { UpdateLeaderboardRow(); isLeaderboardScreen = false; } if (Confirm()) { switch (pos) { case 0: animator.SetBool("ChangeScene", true); ChangeScene("Operation-Starshine-Level", 1.1f); break; case 1: animator.SetBool("ChangeScene", true); ChangeScene("Operation-Starshine-Menu", 1.1f); break; default: break; } } } }
protected override void Update() { base.Update(); switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { ConfirmEvent.Invoke(); } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7)) { ReturnEvent.Invoke(); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { ConfirmEvent.Invoke(); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) { ReturnEvent.Invoke(); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { ConfirmEvent.Invoke(); Debug.Log("I'm being pressed"); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { ReturnEvent.Invoke(); } break; case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { ConfirmEvent.Invoke(); Debug.Log("I'm being pressed"); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { ReturnEvent.Invoke(); } break; case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { ConfirmEvent.Invoke(); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) { ReturnEvent.Invoke(); } break; default: break; } }
void MenuInput_MultiOption() { switch (InputDir) { case Directions.Hoz: switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.JoystickLeft(Joysticks.White)) { StartCoroutine(MoveAroundMenu(-1)); } if (ArcadeControls.JoystickRight(Joysticks.White)) { StartCoroutine(MoveAroundMenu(1)); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ControllerLeft(Players.P1)) { StartCoroutine(MoveAroundMenu(-1)); } if (ControllerControls.ControllerRight(Players.P1)) { StartCoroutine(MoveAroundMenu(1)); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.KeyboardLeft(Players.P1)) { StartCoroutine(MoveAroundMenu(-1)); } if (KeyboardControls.KeyboardRight(Players.P1)) { StartCoroutine(MoveAroundMenu(1)); } break; case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.KeyboardLeft(Players.P1)) { StartCoroutine(MoveAroundMenu(-1)); } if (KeyboardControls.KeyboardRight(Players.P1)) { StartCoroutine(MoveAroundMenu(1)); } break; case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ControllerLeft(Players.P1)) { StartCoroutine(MoveAroundMenu(-1)); } if (ControllerControls.ControllerRight(Players.P1)) { StartCoroutine(MoveAroundMenu(1)); } break; default: break; } break; case Directions.Ver: switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.JoystickUp(Joysticks.White)) { StartCoroutine(MoveAroundMenu(-1)); } if (ArcadeControls.JoystickDown(Joysticks.White)) { StartCoroutine(MoveAroundMenu(1)); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ControllerUp(Players.P1)) { StartCoroutine(MoveAroundMenu(-1)); } if (ControllerControls.ControllerDown(Players.P1)) { StartCoroutine(MoveAroundMenu(1)); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.KeyboardUp(Players.P1)) { StartCoroutine(MoveAroundMenu(-1)); } if (KeyboardControls.KeyboardDown(Players.P1)) { StartCoroutine(MoveAroundMenu(1)); } break; case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.KeyboardUp(Players.P1)) { StartCoroutine(MoveAroundMenu(-1)); } if (KeyboardControls.KeyboardDown(Players.P1)) { StartCoroutine(MoveAroundMenu(1)); } break; case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ControllerUp(Players.P1)) { StartCoroutine(MoveAroundMenu(-1)); } if (ControllerControls.ControllerDown(Players.P1)) { StartCoroutine(MoveAroundMenu(1)); } break; default: break; } break; } switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { RunEvent(); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm)) { RunEvent(); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { RunEvent(); } break; case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { RunEvent(); } break; case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm)) { RunEvent(); } break; default: break; } }
void PlayerSelectionMovement(Joysticks PlayerInput) { switch (PlayerInput) { case Joysticks.White: switch (ControllerType) { case SupportedControllers.ArcadeBoard: if ((ArcadeControls.JoystickLeft(PlayerInput)) && (!Player1Inputted)) { MenuAM.Play("Menu_Click", .4f); --Player1Pos; if (Player1Pos < 0) { Player1Pos = Player1MaxPos - 1; } StartCoroutine(InputLagP1(.2f)); } else if ((ArcadeControls.JoystickRight(PlayerInput)) && (!Player1Inputted)) { MenuAM.Play("Menu_Click", .4f); ++Player1Pos; if (Player1Pos > Player1MaxPos - 1) { Player1Pos = 0; } StartCoroutine(InputLagP1(.2f)); } break; case SupportedControllers.GamePadBoth: if ((ControllerControls.ControllerLeft(Players.P1)) && (!Player1Inputted)) { MenuAM.Play("Menu_Click", .4f); --Player1Pos; if (Player1Pos < 0) { Player1Pos = Player1MaxPos - 1; } StartCoroutine(InputLagP1(.2f)); } else if ((ControllerControls.ControllerRight(Players.P1)) && (!Player1Inputted)) { MenuAM.Play("Menu_Click", .4f); ++Player1Pos; if (Player1Pos > Player1MaxPos - 1) { Player1Pos = 0; } StartCoroutine(InputLagP1(.2f)); } break; case SupportedControllers.KeyboardBoth: if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!Player1Inputted)) { MenuAM.Play("Menu_Click", .4f); --Player1Pos; if (Player1Pos < 0) { Player1Pos = Player1MaxPos - 1; } StartCoroutine(InputLagP1(.2f)); } else if ((KeyboardControls.KeyboardRight(Players.P1)) && (!Player1Inputted)) { MenuAM.Play("Menu_Click", .4f); ++Player1Pos; if (Player1Pos > Player1MaxPos - 1) { Player1Pos = 0; } StartCoroutine(InputLagP1(.2f)); } break; case SupportedControllers.KeyboardP1ControllerP2: if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!Player1Inputted)) { MenuAM.Play("Menu_Click", .4f); --Player1Pos; if (Player1Pos < 0) { Player1Pos = Player1MaxPos - 1; } StartCoroutine(InputLagP1(.2f)); } else if ((KeyboardControls.KeyboardRight(Players.P1)) && (!Player1Inputted)) { MenuAM.Play("Menu_Click", .4f); ++Player1Pos; if (Player1Pos > Player1MaxPos - 1) { Player1Pos = 0; } StartCoroutine(InputLagP1(.2f)); } break; case SupportedControllers.KeyboardP2ControllerP1: if ((ControllerControls.ControllerLeft(Players.P1)) && (!Player1Inputted)) { MenuAM.Play("Menu_Click", .4f); --Player1Pos; if (Player1Pos < 0) { Player1Pos = Player1MaxPos - 1; } StartCoroutine(InputLagP1(.2f)); } else if ((ControllerControls.ControllerRight(Players.P1)) && (!Player1Inputted)) { MenuAM.Play("Menu_Click", .4f); ++Player1Pos; if (Player1Pos > Player1MaxPos - 1) { Player1Pos = 0; } StartCoroutine(InputLagP1(.2f)); } break; default: break; } break; case Joysticks.Black: switch (ControllerType) { case SupportedControllers.ArcadeBoard: if ((ArcadeControls.JoystickLeft(PlayerInput)) && (!Player2Inputted)) { MenuAM.Play("Menu_Click", .4f); --Player2Pos; if (Player2Pos < 0) { Player2Pos = Player2MaxPos - 1; } StartCoroutine(InputLagP2(.2f)); } else if ((ArcadeControls.JoystickRight(PlayerInput)) && (!Player2Inputted)) { MenuAM.Play("Menu_Click", .4f); ++Player2Pos; if (Player2Pos > Player2MaxPos - 1) { Player2Pos = 0; } StartCoroutine(InputLagP2(.2f)); } break; case SupportedControllers.GamePadBoth: if ((ControllerControls.ControllerLeft(Players.P2)) && (!Player2Inputted)) { MenuAM.Play("Menu_Click", .4f); --Player2Pos; if (Player2Pos < 0) { Player2Pos = Player2MaxPos - 1; } StartCoroutine(InputLagP2(.2f)); } else if ((ControllerControls.ControllerRight(Players.P2)) && (!Player2Inputted)) { MenuAM.Play("Menu_Click", .4f); ++Player2Pos; if (Player2Pos > Player2MaxPos - 1) { Player2Pos = 0; } StartCoroutine(InputLagP2(.2f)); } break; case SupportedControllers.KeyboardBoth: if ((KeyboardControls.KeyboardLeft(Players.P2)) && (!Player2Inputted)) { MenuAM.Play("Menu_Click", .4f); --Player2Pos; if (Player2Pos < 0) { Player2Pos = Player2MaxPos - 1; } StartCoroutine(InputLagP2(.2f)); } else if ((KeyboardControls.KeyboardRight(Players.P2)) && (!Player2Inputted)) { MenuAM.Play("Menu_Click", .4f); ++Player2Pos; if (Player2Pos > Player2MaxPos - 1) { Player2Pos = 0; } StartCoroutine(InputLagP2(.2f)); } break; case SupportedControllers.KeyboardP1ControllerP2: if ((ControllerControls.ControllerLeft(Players.P1)) && (!Player2Inputted)) { MenuAM.Play("Menu_Click", .4f); --Player2Pos; if (Player2Pos < 0) { Player2Pos = Player2MaxPos - 1; } StartCoroutine(InputLagP2(.2f)); } else if ((ControllerControls.ControllerRight(Players.P1)) && (!Player2Inputted)) { MenuAM.Play("Menu_Click", .4f); ++Player2Pos; if (Player2Pos > Player2MaxPos - 1) { Player2Pos = 0; } StartCoroutine(InputLagP2(.2f)); } break; case SupportedControllers.KeyboardP2ControllerP1: if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!Player2Inputted)) { MenuAM.Play("Menu_Click", .4f); --Player2Pos; if (Player2Pos < 0) { Player2Pos = Player2MaxPos - 1; } StartCoroutine(InputLagP2(.2f)); } else if ((KeyboardControls.KeyboardRight(Players.P1)) && (!Player2Inputted)) { MenuAM.Play("Menu_Click", .4f); ++Player2Pos; if (Player2Pos > Player2MaxPos - 1) { Player2Pos = 0; } StartCoroutine(InputLagP2(.2f)); } break; default: break; } break; } }
void ConfirmOption(Joysticks PlayerInput) { switch (PlayerInput) { case Joysticks.White: switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { MenuAM.Play("Menu_Select"); Player1Selected = true; } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { MenuAM.Play("Menu_Select"); Player1Selected = true; } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { MenuAM.Play("Menu_Select"); Player1Selected = true; } break; case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { MenuAM.Play("Menu_Select"); Player1Selected = true; } break; case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { MenuAM.Play("Menu_Select"); Player1Selected = true; } break; default: break; } break; case Joysticks.Black: switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.Black, Buttons.B8)) { MenuAM.Play("Menu_Select"); Player2Selected = true; } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.A)) { MenuAM.Play("Menu_Select"); Player2Selected = true; } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P2, Buttons.B8)) { MenuAM.Play("Menu_Select"); Player2Selected = true; } break; case SupportedControllers.KeyboardP1ControllerP2: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { MenuAM.Play("Menu_Select"); Player2Selected = true; } break; case SupportedControllers.KeyboardP2ControllerP1: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { MenuAM.Play("Menu_Select"); Player2Selected = true; } break; default: break; } break; } }
private void RotatePlayer() { switch (ControllerType) { case SupportedControllers.ArcadeBoard: switch (Ducks) { case DuckPlayers.P1: if (ArcadeControls.JoystickLeft(Joysticks.White)) { transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0); } else if (ArcadeControls.JoystickRight(Joysticks.White)) { transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0); } break; case DuckPlayers.P2: if (ArcadeControls.JoystickLeft(Joysticks.Black)) { transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0); } else if (ArcadeControls.JoystickRight(Joysticks.Black)) { transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0); } break; } break; case SupportedControllers.GamePadBoth: switch (Ducks) { case DuckPlayers.P1: if (ControllerControls.ControllerLeft(Players.P1)) { transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0); } else if (ControllerControls.ControllerRight(Players.P1)) { transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0); } break; case DuckPlayers.P2: if (ControllerControls.ControllerLeft(Players.P2)) { transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0); } else if (ControllerControls.ControllerRight(Players.P2)) { transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0); } break; } break; case SupportedControllers.KeyboardBoth: switch (Ducks) { case DuckPlayers.P1: if (KeyboardControls.KeyboardLeft(Players.P1)) { transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0); } else if (KeyboardControls.KeyboardRight(Players.P1)) { transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0); } break; case DuckPlayers.P2: if (KeyboardControls.KeyboardLeft(Players.P2)) { transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0); } else if (KeyboardControls.KeyboardRight(Players.P2)) { transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0); } break; } break; case SupportedControllers.KeyboardP1ControllerP2: switch (Ducks) { case DuckPlayers.P1: if (KeyboardControls.KeyboardLeft(Players.P1)) { transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0); } else if (KeyboardControls.KeyboardRight(Players.P1)) { transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0); } break; case DuckPlayers.P2: if (ControllerControls.ControllerLeft(Players.P1)) { transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0); } else if (ControllerControls.ControllerRight(Players.P1)) { transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0); } break; } break; case SupportedControllers.KeyboardP2ControllerP1: switch (Ducks) { case DuckPlayers.P2: if (KeyboardControls.KeyboardLeft(Players.P1)) { transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0); } else if (KeyboardControls.KeyboardRight(Players.P1)) { transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0); } break; case DuckPlayers.P1: if (ControllerControls.ControllerLeft(Players.P1)) { transform.localEulerAngles += new Vector3(0, -1 * 3, 0); } else if (ControllerControls.ControllerRight(Players.P1)) { transform.localEulerAngles += new Vector3(0, 1 * 3, 0); } break; } break; default: break; } }
public void MoveLR() { switch (ControllerType) { case SupportedControllers.ArcadeBoard: if ((ArcadeControls.JoystickLeft(Joysticks.White)) && (!isCoR)) { StartCoroutine(MoveAround(-1)); } if ((ArcadeControls.JoystickRight(Joysticks.White)) && (!isCoR)) { StartCoroutine(MoveAround(1)); } break; case SupportedControllers.GamePadBoth: if ((ControllerControls.ControllerLeft(Players.P1)) && (!isCoR)) { StartCoroutine(MoveAround(-1)); } if ((ControllerControls.ControllerRight(Players.P1)) && (!isCoR)) { StartCoroutine(MoveAround(1)); } break; case SupportedControllers.KeyboardBoth: if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!isCoR)) { StartCoroutine(MoveAround(-1)); } if ((KeyboardControls.KeyboardRight(Players.P1)) && (!isCoR)) { StartCoroutine(MoveAround(1)); } break; case SupportedControllers.KeyboardP1ControllerP2: if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!isCoR)) { StartCoroutine(MoveAround(-1)); } if ((KeyboardControls.KeyboardRight(Players.P1)) && (!isCoR)) { StartCoroutine(MoveAround(1)); } break; case SupportedControllers.KeyboardP2ControllerP1: if ((ControllerControls.ControllerLeft(Players.P1)) && (!isCoR)) { StartCoroutine(MoveAround(-1)); } if ((ControllerControls.ControllerRight(Players.P1)) && (!isCoR)) { StartCoroutine(MoveAround(1)); } break; default: break; } }
public bool Confirm() { if (inputReady) { switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { StartCoroutine(InputLag()); return(true); } else { return(false); } case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { StartCoroutine(InputLag()); return(true); } else { return(false); } case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { StartCoroutine(InputLag()); Debug.Log(">> Confirm Pressed <<"); return(true); } else { return(false); } case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { StartCoroutine(InputLag()); return(true); } else { return(false); } case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { StartCoroutine(InputLag()); return(true); } else { return(false); } default: return(false); } } else { return(false); } }
public bool Return(ControllerButtons DesiredButton) { if (inputReady) { switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7)) { StartCoroutine(InputLag()); return(true); } else { return(false); } case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P1, DesiredButton)) { StartCoroutine(InputLag()); return(true); } else { return(false); } case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { StartCoroutine(InputLag()); return(true); } else { return(false); } case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { StartCoroutine(InputLag()); return(true); } else { return(false); } case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ButtonPress(Players.P1, DesiredButton)) { StartCoroutine(InputLag()); return(true); } else { return(false); } default: return(false); } } else { return(false); } }
protected override void Update() { base.Update(); switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { ConfirmP1(); } if (ArcadeControls.ButtonPress(Joysticks.Black, Buttons.B8)) { ConfirmP2(); } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7)) { ReturnP1(); } if (ArcadeControls.ButtonPress(Joysticks.Black, Buttons.B7)) { ReturnP2(); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm)) { ConfirmP1(); } if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Confirm)) { ConfirmP2(); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Return)) { ReturnP1(); } if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Return)) { ReturnP2(); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { ConfirmP1(); } if (KeyboardControls.ButtonPress(Players.P2, Buttons.B8)) { ConfirmP2(); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { ReturnP1(); } if (KeyboardControls.ButtonPress(Players.P2, Buttons.B7)) { ReturnP2(); } break; case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { ConfirmP1(); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm)) { ConfirmP2(); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { ReturnP1(); } if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Return)) { ReturnP2(); } break; case SupportedControllers.KeyboardP2ControllerP1: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { ConfirmP2(); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm)) { ConfirmP1(); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { ReturnP2(); } if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Return)) { ReturnP1(); } break; default: break; } if ((Player1Ready) && (Player2Ready)) { SendDataToBoard(Player1_LB_Data, 0); SendDataToBoard(Player2_LB_Data, 1); // change after sent GetComponentInParent <CanvasGroup>().alpha -= Time.deltaTime * 2; StartCoroutine(WaitAndEnableMenuCtrl()); } }
private void FixedUpdate() { // Switches the flippers between left and right switch (ThisFlipper) { case FlipperSides.Left: switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.JoystickLeft(Input)) { FlipLeftFlipper(); } else if (ArcadeControls.JoystickNone(Input)) { ResetLeftFlipper(); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ControllerLeft(ConvertToPlayers())) { FlipLeftFlipper(); } else if (ControllerControls.ControllerNone(ConvertToPlayers())) { ResetLeftFlipper(); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.KeyboardLeft(ConvertToPlayers())) { FlipLeftFlipper(); } else if (KeyboardControls.KeyboardNone(ConvertToPlayers())) { ResetLeftFlipper(); } break; case SupportedControllers.KeyboardP1ControllerP2: if (ConvertToPlayers() == Players.P1) { if (KeyboardControls.KeyboardLeft(Players.P1)) { FlipLeftFlipper(); } else if (KeyboardControls.KeyboardNone(Players.P1)) { ResetLeftFlipper(); } } else { if (ControllerControls.ControllerLeft(Players.P1)) { FlipLeftFlipper(); } else if (ControllerControls.ControllerNone(Players.P1)) { ResetLeftFlipper(); } } break; case SupportedControllers.KeyboardP2ControllerP1: if (ConvertToPlayers() == Players.P2) { if (KeyboardControls.KeyboardLeft(Players.P1)) { FlipLeftFlipper(); } else if (KeyboardControls.KeyboardNone(Players.P1)) { ResetLeftFlipper(); } } else { if (ControllerControls.ControllerLeft(Players.P1)) { FlipLeftFlipper(); } else if (ControllerControls.ControllerNone(Players.P1)) { ResetLeftFlipper(); } } break; default: break; } break; case FlipperSides.Right: switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.JoystickRight(Input)) { FlipRightFlipper(); } else if (ArcadeControls.JoystickNone(Input)) { ResetRightFlipper(); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ControllerRight(ConvertToPlayers())) { FlipRightFlipper(); } else if (ControllerControls.ControllerNone(ConvertToPlayers())) { ResetRightFlipper(); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.KeyboardRight(ConvertToPlayers())) { FlipRightFlipper(); } else if (KeyboardControls.KeyboardNone(ConvertToPlayers())) { ResetRightFlipper(); } break; case SupportedControllers.KeyboardP1ControllerP2: if (ConvertToPlayers() == Players.P1) { if (KeyboardControls.KeyboardRight(Players.P1)) { FlipRightFlipper(); } else if (KeyboardControls.KeyboardNone(Players.P1)) { ResetRightFlipper(); } } else { if (ControllerControls.ControllerRight(Players.P1)) { FlipRightFlipper(); } else if (ControllerControls.ControllerNone(Players.P1)) { ResetRightFlipper(); } } break; case SupportedControllers.KeyboardP2ControllerP1: if (ConvertToPlayers() == Players.P2) { if (KeyboardControls.KeyboardRight(Players.P1)) { FlipRightFlipper(); } else if (KeyboardControls.KeyboardNone(Players.P1)) { ResetRightFlipper(); } } else { if (ControllerControls.ControllerRight(Players.P1)) { FlipRightFlipper(); } else if (ControllerControls.ControllerNone(Players.P1)) { ResetRightFlipper(); } } break; default: break; } break; default: break; } }
protected override void Update() { switch (ControllerType) { case SupportedControllers.ArcadeBoard: // Player 1 if ((ArcadeControls.JoystickLeft(Joysticks.White) && (!IsCoR_P1) && (!ReadyP1))) { StartCoroutine(ToggleSelP1(1)); } if ((ArcadeControls.JoystickRight(Joysticks.White) && (!IsCoR_P1) && (!ReadyP1))) { StartCoroutine(ToggleSelP1(-1)); } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { am.Play("Menu_Select", .75f); ReadyP1 = !ReadyP1; Ready[0].enabled = ReadyP1; } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7)) { am.Play("Confirm", .25f); SC.MoveToDucks = false; SC.MoveToRounds = true; RSC.enabled = true; this.enabled = false; } // Player 2 if ((ArcadeControls.JoystickLeft(Joysticks.Black) && (!IsCoR_P2) && (!ReadyP2))) { StartCoroutine(ToggleSelP2(1)); } if ((ArcadeControls.JoystickRight(Joysticks.Black) && (!IsCoR_P2) && (!ReadyP2))) { StartCoroutine(ToggleSelP2(-1)); } if (ArcadeControls.ButtonPress(Joysticks.Black, Buttons.B8)) { am.Play("Menu_Select", .75f); ReadyP2 = !ReadyP2; Ready[1].enabled = ReadyP2; } break; case SupportedControllers.GamePadBoth: // Player 1 if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1))) { StartCoroutine(ToggleSelP1(1)); } if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1))) { StartCoroutine(ToggleSelP1(-1)); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm)) { am.Play("Menu_Select", .75f); ReadyP1 = !ReadyP1; Ready[0].enabled = ReadyP1; } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) { am.Play("Confirm", .25f); SC.MoveToDucks = false; SC.MoveToRounds = true; RSC.enabled = true; this.enabled = false; } // Player 2 if ((ControllerControls.ControllerLeft(Players.P2) && (!IsCoR_P2) && (!ReadyP2))) { StartCoroutine(ToggleSelP2(1)); } if ((ControllerControls.ControllerRight(Players.P2) && (!IsCoR_P2) && (!ReadyP2))) { StartCoroutine(ToggleSelP2(-1)); } if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Confirm)) { am.Play("Menu_Select", .75f); ReadyP2 = !ReadyP2; Ready[1].enabled = ReadyP2; } break; case SupportedControllers.KeyboardBoth: if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1))) { StartCoroutine(ToggleSelP1(1)); } if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1))) { StartCoroutine(ToggleSelP1(-1)); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { am.Play("Menu_Select", .75f); ReadyP1 = !ReadyP1; Ready[0].enabled = ReadyP1; } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { am.Play("Confirm", .25f); SC.MoveToDucks = false; SC.MoveToRounds = true; RSC.enabled = true; this.enabled = false; } // Player 2 if ((KeyboardControls.KeyboardLeft(Players.P2) && (!IsCoR_P2) && (!ReadyP2))) { StartCoroutine(ToggleSelP2(1)); } if ((KeyboardControls.KeyboardRight(Players.P2) && (!IsCoR_P2) && (!ReadyP2))) { StartCoroutine(ToggleSelP2(-1)); } if (KeyboardControls.ButtonPress(Players.P2, Buttons.B8)) { am.Play("Menu_Select", .75f); ReadyP2 = !ReadyP2; Ready[1].enabled = ReadyP2; } break; case SupportedControllers.KeyboardP1ControllerP2: if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1))) { StartCoroutine(ToggleSelP1(1)); } if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1))) { StartCoroutine(ToggleSelP1(-1)); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { am.Play("Menu_Select", .75f); ReadyP1 = !ReadyP1; Ready[0].enabled = ReadyP1; } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { am.Play("Confirm", .25f); SC.MoveToDucks = false; SC.MoveToRounds = true; RSC.enabled = true; this.enabled = false; } if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR_P2) && (!ReadyP2))) { StartCoroutine(ToggleSelP2(1)); } if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR_P2) && (!ReadyP2))) { StartCoroutine(ToggleSelP2(-1)); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { am.Play("Menu_Select", .75f); ReadyP2 = !ReadyP2; Ready[1].enabled = ReadyP2; } break; case SupportedControllers.KeyboardP2ControllerP1: if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1))) { StartCoroutine(ToggleSelP1(1)); } if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1))) { StartCoroutine(ToggleSelP1(-1)); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { am.Play("Menu_Select", .75f); ReadyP1 = !ReadyP1; Ready[0].enabled = ReadyP1; } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) { am.Play("Confirm", .25f); SC.MoveToDucks = false; SC.MoveToRounds = true; RSC.enabled = true; this.enabled = false; } if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR_P2) && (!ReadyP2))) { StartCoroutine(ToggleSelP2(1)); } if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR_P2) && (!ReadyP2))) { StartCoroutine(ToggleSelP2(-1)); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { am.Play("Menu_Select", .75f); ReadyP2 = !ReadyP2; Ready[1].enabled = ReadyP2; } break; default: break; } if (ReadyP1 && ReadyP2) { QuackingTimeData _data = new QuackingTimeData(Duck1Pos, Duck2Pos); SaveManager.SaveQuackingTime(_data); ChangeScene.ChangeToLevel(); } }
protected override void Update() { if (IsEnabled) { switch (ControllerType) { case SupportedControllers.ArcadeBoard: // Shoot Main Weapon on B1 Press if ((ArcadeControls.ButtonHeldDown(Player, Buttons.B1)) && (CanShootMain)) { audioManager.Play("Shoot", Random.Range(.04f, .1f), Random.Range(.9f, 1f)); CanShootMain = false; StartCoroutine(base.ShootMainWeapon(Vector2.up, 10, (int)Player + 1)); } // Shoot Alt Weapon on B2 Press if ((ArcadeControls.ButtonPress(Player, Buttons.B2)) && (CanShootAlt)) { audioManager.PlayFromTime("MissileShoot", .5f, .2f); CanShootAlt = false; StartCoroutine(base.ShootAltWeapon(Vector2.up, 10, (int)Player + 1)); } // Use Special Move on B3 Press if ((ArcadeControls.ButtonPress(Player, Buttons.B3)) && (CanUseSpecialMove)) { ExecuteSpecialMove(); } // Shield - Protect from bolts if ((ArcadeControls.ButtonPress(Player, Buttons.B4)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Bolts; PlayerStats.shieldSwitches++; } // Shield - Protect from misisles if ((ArcadeControls.ButtonPress(Player, Buttons.B5)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Missiles; PlayerStats.shieldSwitches++; } // Shield - Regen Shields if ((ArcadeControls.ButtonPress(Player, Buttons.B6)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Regen; PlayerStats.shieldSwitches++; } break; case SupportedControllers.GamePadBoth: // Shoot Main Weapon on B1 Press if ((ControllerControls.ButtonHeldDown(ConvertToPlayers(), ControllerButtons.A)) && (CanShootMain)) { audioManager.Play("Shoot", Random.Range(.04f, .1f), Random.Range(.9f, 1f)); CanShootMain = false; StartCoroutine(base.ShootMainWeapon(Vector2.up, 10, (int)Player + 1)); } // Shoot Alt Weapon on B2 Press if ((ControllerControls.ButtonPress(ConvertToPlayers(), ControllerButtons.B)) && (CanShootAlt)) { audioManager.PlayFromTime("MissileShoot", .5f, .2f); CanShootAlt = false; StartCoroutine(base.ShootAltWeapon(Vector2.up, 10, (int)Player + 1)); } // Use Special Move on B3 Press if ((ControllerControls.ButtonPress(ConvertToPlayers(), ControllerButtons.X)) && (CanUseSpecialMove)) { ExecuteSpecialMove(); } // Shield - Protect from bolts if ((ControllerControls.ButtonPress(ConvertToPlayers(), ControllerButtons.LB)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Bolts; PlayerStats.shieldSwitches++; } // Shield - Protect from misisles if ((ControllerControls.ButtonPress(ConvertToPlayers(), ControllerButtons.RB)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Missiles; PlayerStats.shieldSwitches++; } // Shield - Regen Shields if ((ControllerControls.ButtonPress(ConvertToPlayers(), ControllerButtons.Y)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Regen; PlayerStats.shieldSwitches++; } break; case SupportedControllers.KeyboardBoth: // Shoot Main Weapon on B1 Press if ((KeyboardControls.ButtonHeldDown(ConvertToPlayers(), Buttons.B1)) && (CanShootMain)) { audioManager.Play("Shoot", Random.Range(.04f, .1f), Random.Range(.9f, 1f)); CanShootMain = false; StartCoroutine(base.ShootMainWeapon(Vector2.up, 10, (int)Player + 1)); } // Shoot Alt Weapon on B2 Press if ((KeyboardControls.ButtonPress(ConvertToPlayers(), Buttons.B2)) && (CanShootAlt)) { audioManager.PlayFromTime("MissileShoot", .5f, .2f); CanShootAlt = false; StartCoroutine(base.ShootAltWeapon(Vector2.up, 10, (int)Player + 1)); } // Use Special Move on B3 Press if ((KeyboardControls.ButtonPress(ConvertToPlayers(), Buttons.B3)) && (CanUseSpecialMove)) { ExecuteSpecialMove(); } // Shield - Protect from bolts if ((KeyboardControls.ButtonPress(ConvertToPlayers(), Buttons.B4)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Bolts; PlayerStats.shieldSwitches++; } // Shield - Protect from misisles if ((KeyboardControls.ButtonPress(ConvertToPlayers(), Buttons.B5)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Missiles; PlayerStats.shieldSwitches++; } // Shield - Regen Shields if ((KeyboardControls.ButtonPress(ConvertToPlayers(), Buttons.B6)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Regen; PlayerStats.shieldSwitches++; } break; case SupportedControllers.KeyboardP1ControllerP2: if (ConvertToPlayers() == Players.P1) { // Shoot Main Weapon on B1 Press if ((KeyboardControls.ButtonHeldDown(Players.P1, Buttons.B1)) && (CanShootMain)) { audioManager.Play("Shoot", Random.Range(.04f, .1f), Random.Range(.9f, 1f)); CanShootMain = false; StartCoroutine(base.ShootMainWeapon(Vector2.up, 10, (int)Player + 1)); } // Shoot Alt Weapon on B2 Press if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B2)) && (CanShootAlt)) { audioManager.PlayFromTime("MissileShoot", .5f, .2f); CanShootAlt = false; StartCoroutine(base.ShootAltWeapon(Vector2.up, 10, (int)Player + 1)); } // Use Special Move on B3 Press if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B3)) && (CanUseSpecialMove)) { ExecuteSpecialMove(); } // Shield - Protect from bolts if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B4)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Bolts; PlayerStats.shieldSwitches++; } // Shield - Protect from misisles if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B5)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Missiles; PlayerStats.shieldSwitches++; } // Shield - Regen Shields if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B6)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Regen; PlayerStats.shieldSwitches++; } } else { // Shoot Main Weapon on B1 Press if ((ControllerControls.ButtonHeldDown(Players.P1, ControllerButtons.A)) && (CanShootMain)) { audioManager.Play("Shoot", Random.Range(.04f, .1f), Random.Range(.9f, 1f)); CanShootMain = false; StartCoroutine(base.ShootMainWeapon(Vector2.up, 10, (int)Player + 1)); } // Shoot Alt Weapon on B2 Press if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) && (CanShootAlt)) { audioManager.PlayFromTime("MissileShoot", .5f, .2f); CanShootAlt = false; StartCoroutine(base.ShootAltWeapon(Vector2.up, 10, (int)Player + 1)); } // Use Special Move on B3 Press if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.X)) && (CanUseSpecialMove)) { ExecuteSpecialMove(); } // Shield - Protect from bolts if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.LB)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Bolts; PlayerStats.shieldSwitches++; } // Shield - Protect from misisles if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.RB)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Missiles; PlayerStats.shieldSwitches++; } // Shield - Regen Shields if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.Y)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Regen; PlayerStats.shieldSwitches++; } } break; case SupportedControllers.KeyboardP2ControllerP1: if (ConvertToPlayers() == Players.P2) { // Shoot Main Weapon on B1 Press if ((KeyboardControls.ButtonHeldDown(Players.P1, Buttons.B1)) && (CanShootMain)) { audioManager.Play("Shoot", Random.Range(.04f, .1f), Random.Range(.9f, 1f)); CanShootMain = false; StartCoroutine(base.ShootMainWeapon(Vector2.up, 10, (int)Player + 1)); } // Shoot Alt Weapon on B2 Press if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B2)) && (CanShootAlt)) { audioManager.PlayFromTime("MissileShoot", .5f, .2f); CanShootAlt = false; StartCoroutine(base.ShootAltWeapon(Vector2.up, 10, (int)Player + 1)); } // Use Special Move on B3 Press if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B3)) && (CanUseSpecialMove)) { ExecuteSpecialMove(); } // Shield - Protect from bolts if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B4)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Bolts; PlayerStats.shieldSwitches++; } // Shield - Protect from misisles if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B5)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Missiles; PlayerStats.shieldSwitches++; } // Shield - Regen Shields if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B6)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Regen; PlayerStats.shieldSwitches++; } } else { // Shoot Main Weapon on B1 Press if ((ControllerControls.ButtonHeldDown(Players.P1, ControllerButtons.A)) && (CanShootMain)) { audioManager.Play("Shoot", Random.Range(.04f, .1f), Random.Range(.9f, 1f)); CanShootMain = false; StartCoroutine(base.ShootMainWeapon(Vector2.up, 10, (int)Player + 1)); } // Shoot Alt Weapon on B2 Press if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) && (CanShootAlt)) { audioManager.PlayFromTime("MissileShoot", .5f, .2f); CanShootAlt = false; StartCoroutine(base.ShootAltWeapon(Vector2.up, 10, (int)Player + 1)); } // Use Special Move on B3 Press if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.X)) && (CanUseSpecialMove)) { ExecuteSpecialMove(); } // Shield - Protect from bolts if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.LB)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Bolts; PlayerStats.shieldSwitches++; } // Shield - Protect from misisles if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.RB)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Missiles; PlayerStats.shieldSwitches++; } // Shield - Regen Shields if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.Y)) && (CanChangeSheildType)) { ActiveShieldType = ShieldTypes.Regen; PlayerStats.shieldSwitches++; } } break; default: break; } } // Runs the base update function on ship movement base.Update(); // Clamp the players to the scene view (so they can't dodge off screen) }
public int GetLRDir() { switch (ControllerType) { case SupportedControllers.ArcadeBoard: if ((ArcadeControls.JoystickLeft(Joysticks.White)) && (!isCoR)) { return(-1); } if ((ArcadeControls.JoystickRight(Joysticks.White)) && (!isCoR)) { return(1); } else { return(0); } case SupportedControllers.GamePadBoth: if ((ControllerControls.ControllerLeft(Players.P1)) && (!isCoR)) { return(-1); } if ((ControllerControls.ControllerRight(Players.P1)) && (!isCoR)) { return(1); } else { return(0); } case SupportedControllers.KeyboardBoth: if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!isCoR)) { return(-1); } if ((KeyboardControls.KeyboardRight(Players.P1)) && (!isCoR)) { return(1); } else { return(0); } case SupportedControllers.KeyboardP1ControllerP2: if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!isCoR)) { return(-1); } if ((KeyboardControls.KeyboardRight(Players.P1)) && (!isCoR)) { return(1); } else { return(0); } case SupportedControllers.KeyboardP2ControllerP1: if ((ControllerControls.ControllerLeft(Players.P1)) && (!isCoR)) { return(-1); } if ((ControllerControls.ControllerRight(Players.P1)) && (!isCoR)) { return(1); } else { return(0); } default: return(0); } }
protected override void Update() { base.Update(); UpdateDisplay(); switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { SetNumberofRounds(Selection); am.Play("Menu-Confirm", .25f); OpenCustomMenu(); } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7)) { am.Play("Confirm", .25f); BackToRootMenu(); } if (ArcadeControls.JoystickLeft(Joysticks.White) && !IsCoR) { StartCoroutine(RoundsSelect(-1)); } if (ArcadeControls.JoystickRight(Joysticks.White) && !IsCoR) { StartCoroutine(RoundsSelect(1)); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { SetNumberofRounds(Selection); am.Play("Menu-Confirm", .25f); OpenCustomMenu(); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) { am.Play("Confirm", .25f); BackToRootMenu(); } if (ControllerControls.ControllerLeft(Players.P1) && !IsCoR) { StartCoroutine(RoundsSelect(-1)); } if (ControllerControls.ControllerRight(Players.P1) && !IsCoR) { StartCoroutine(RoundsSelect(1)); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { SetNumberofRounds(Selection); am.Play("Menu-Confirm", .25f); OpenCustomMenu(); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { am.Play("Confirm", .25f); BackToRootMenu(); } if (KeyboardControls.KeyboardLeft(Players.P1) && !IsCoR) { StartCoroutine(RoundsSelect(-1)); } if (KeyboardControls.KeyboardRight(Players.P1) && !IsCoR) { StartCoroutine(RoundsSelect(1)); } break; case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { SetNumberofRounds(Selection); am.Play("Menu-Confirm", .25f); OpenCustomMenu(); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { am.Play("Confirm", .25f); BackToRootMenu(); } if (KeyboardControls.KeyboardLeft(Players.P1) && !IsCoR) { StartCoroutine(RoundsSelect(-1)); } if (KeyboardControls.KeyboardRight(Players.P1) && !IsCoR) { StartCoroutine(RoundsSelect(1)); } break; case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { SetNumberofRounds(Selection); am.Play("Menu-Confirm", .25f); OpenCustomMenu(); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) { am.Play("Confirm", .25f); BackToRootMenu(); } if (ControllerControls.ControllerLeft(Players.P1) && !IsCoR) { StartCoroutine(RoundsSelect(-1)); } if (ControllerControls.ControllerRight(Players.P1) && !IsCoR) { StartCoroutine(RoundsSelect(1)); } break; default: break; } }
protected override void Update() { base.Update(); // If the joystick is pressed down switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.JoystickDown(ThisPlayer)) { FlipBoth(); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ControllerDown(ConvertToPlayers())) { FlipBoth(); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.KeyboardDown(ConvertToPlayers())) { FlipBoth(); } break; case SupportedControllers.KeyboardP1ControllerP2: if (ConvertToPlayers() == Players.P1) { if (KeyboardControls.KeyboardDown(Players.P1)) { FlipBoth(); } } else { if (ControllerControls.ControllerDown(Players.P1)) { FlipBoth(); } } break; case SupportedControllers.KeyboardP2ControllerP1: if (ConvertToPlayers() == Players.P2) { if (KeyboardControls.KeyboardDown(Players.P1)) { FlipBoth(); } } else { if (ControllerControls.ControllerDown(Players.P1)) { FlipBoth(); } } break; default: break; } }
protected override void Update() { // The base update base.Update(); JumpSmoothing(); if (!JumpCoolRunning) { if (Physics.Linecast(transform.position, transform.position + new Vector3(0, -1.5f, 0), 1 << LayerMask.NameToLayer("Quacking:Ground"))) { CanDuckJump = true; } else { CanDuckJump = false; } } switch (Power) { case Powerups.Explodie: MoveSpd = 8; PowerupLock.SetActive(false); PowerupSpd.SetActive(false); LockHex = false; break; case Powerups.Speedie: MoveSpd = 12; PowerupLock.SetActive(false); PowerupSpd.SetActive(true); LockHex = false; if (!IsSpeedie) { StartCoroutine(SpdDuration()); } mapController.SetControlledHexagonsToUnlocked(Ducks); break; case Powerups.Lockie: MoveSpd = 8; LockHex = true; PowerupLock.SetActive(true); PowerupSpd.SetActive(false); break; case Powerups.None: MoveSpd = 8; LockHex = false; PowerupLock.SetActive(false); PowerupSpd.SetActive(false); break; default: break; } switch (ControllerType) { case SupportedControllers.ArcadeBoard: switch (Ducks) { case DuckPlayers.P1: if (ArcadeControls.JoystickUp(Joysticks.White)) { GoFoward(); } else if (ArcadeControls.JoystickDown(Joysticks.White)) { GoBackwards(); } else { GoNowhere(); } if ((ArcadeControls.ButtonPress(Joysticks.White, Buttons.B1)) && (CanDuckJump)) { am.PlayFromTime("Jump", .05f); GetComponent <Rigidbody>().AddForce(transform.up * JumpHeight, ForceMode.Impulse); StartCoroutine(JumpCooldown()); } break; case DuckPlayers.P2: if (ArcadeControls.JoystickUp(Joysticks.Black)) { GoFoward(); } else if (ArcadeControls.JoystickDown(Joysticks.Black)) { GoBackwards(); } else { GoNowhere(); } if ((ArcadeControls.ButtonPress(Joysticks.Black, Buttons.B1)) && (CanDuckJump)) { am.PlayFromTime("Jump", .05f); GetComponent <Rigidbody>().AddForce(transform.up * JumpHeight, ForceMode.Impulse); StartCoroutine(JumpCooldown()); } break; } break; case SupportedControllers.GamePadBoth: switch (Ducks) { case DuckPlayers.P1: if (ControllerControls.ControllerUp(Players.P1)) { GoFoward(); } else if (ControllerControls.ControllerDown(Players.P1)) { GoBackwards(); } else { GoNowhere(); } if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) && (CanDuckJump)) { am.PlayFromTime("Jump", .05f); GetComponent <Rigidbody>().AddForce(transform.up * JumpHeight, ForceMode.Impulse); StartCoroutine(JumpCooldown()); } break; case DuckPlayers.P2: if (ControllerControls.ControllerUp(Players.P2)) { GoFoward(); } else if (ControllerControls.ControllerDown(Players.P2)) { GoBackwards(); } else { GoNowhere(); } if ((ControllerControls.ButtonPress(Players.P2, ControllerButtons.A)) && (CanDuckJump)) { am.PlayFromTime("Jump", .05f); GetComponent <Rigidbody>().AddForce(transform.up * JumpHeight, ForceMode.Impulse); StartCoroutine(JumpCooldown()); } break; } break; case SupportedControllers.KeyboardBoth: switch (Ducks) { case DuckPlayers.P1: if (KeyboardControls.KeyboardUp(Players.P1)) { GoFoward(); } else if (KeyboardControls.KeyboardDown(Players.P1)) { GoBackwards(); } else { GoNowhere(); } if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B1)) && (CanDuckJump)) { am.PlayFromTime("Jump", .05f); GetComponent <Rigidbody>().AddForce(transform.up * JumpHeight, ForceMode.Impulse); StartCoroutine(JumpCooldown()); } break; case DuckPlayers.P2: if (KeyboardControls.KeyboardUp(Players.P2)) { GoFoward(); } else if (KeyboardControls.KeyboardDown(Players.P2)) { GoBackwards(); } else { GoNowhere(); } if ((KeyboardControls.ButtonPress(Players.P2, Buttons.B1)) && (CanDuckJump)) { am.PlayFromTime("Jump", .05f); GetComponent <Rigidbody>().AddForce(transform.up * JumpHeight, ForceMode.Impulse); StartCoroutine(JumpCooldown()); } break; } break; case SupportedControllers.KeyboardP1ControllerP2: switch (Ducks) { case DuckPlayers.P1: if (KeyboardControls.KeyboardUp(Players.P1)) { GoFoward(); } else if (KeyboardControls.KeyboardDown(Players.P1)) { GoBackwards(); } else { GoNowhere(); } if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B1)) && (CanDuckJump)) { am.PlayFromTime("Jump", .05f); GetComponent <Rigidbody>().AddForce(transform.up * JumpHeight, ForceMode.Impulse); StartCoroutine(JumpCooldown()); } break; case DuckPlayers.P2: if (ControllerControls.ControllerUp(Players.P1)) { GoFoward(); } else if (ControllerControls.ControllerDown(Players.P1)) { GoBackwards(); } else { GoNowhere(); } if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) && (CanDuckJump)) { am.PlayFromTime("Jump", .05f); GetComponent <Rigidbody>().AddForce(transform.up * JumpHeight, ForceMode.Impulse); StartCoroutine(JumpCooldown()); } break; } break; case SupportedControllers.KeyboardP2ControllerP1: switch (Ducks) { case DuckPlayers.P2: if (KeyboardControls.KeyboardUp(Players.P1)) { GoFoward(); } else if (KeyboardControls.KeyboardDown(Players.P1)) { GoBackwards(); } else { GoNowhere(); } if ((KeyboardControls.ButtonPress(Players.P1, Buttons.B1)) && (CanDuckJump)) { am.PlayFromTime("Jump", .05f); GetComponent <Rigidbody>().AddForce(transform.up * JumpHeight, ForceMode.Impulse); StartCoroutine(JumpCooldown()); } break; case DuckPlayers.P1: if (ControllerControls.ControllerUp(Players.P1)) { GoFoward(); } else if (ControllerControls.ControllerDown(Players.P1)) { GoBackwards(); } else { GoNowhere(); } if ((ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) && (CanDuckJump)) { am.PlayFromTime("Jump", .05f); GetComponent <Rigidbody>().AddForce(transform.up * JumpHeight, ForceMode.Impulse); StartCoroutine(JumpCooldown()); } break; } break; default: break; } RotatePlayer(); }
protected override void Update() { switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.JoystickUp(Joysticks.White)) { scrollRect.verticalNormalizedPosition += 1f * Time.deltaTime; } else if (ArcadeControls.JoystickDown(Joysticks.White)) { scrollRect.verticalNormalizedPosition -= 1f * Time.deltaTime; } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ControllerUp(Players.P1)) { scrollRect.verticalNormalizedPosition += 1f * Time.deltaTime; } else if (ControllerControls.ControllerDown(Players.P1)) { scrollRect.verticalNormalizedPosition -= 1f * Time.deltaTime; } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.KeyboardUp(Players.P1)) { scrollRect.verticalNormalizedPosition += 1f * Time.deltaTime; } else if (KeyboardControls.KeyboardDown(Players.P1)) { scrollRect.verticalNormalizedPosition -= 1f * Time.deltaTime; } break; case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.KeyboardUp(Players.P1)) { scrollRect.verticalNormalizedPosition += 1f * Time.deltaTime; } else if (KeyboardControls.KeyboardDown(Players.P1)) { scrollRect.verticalNormalizedPosition -= 1f * Time.deltaTime; } break; case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ControllerUp(Players.P1)) { scrollRect.verticalNormalizedPosition += 1f * Time.deltaTime; } else if (ControllerControls.ControllerDown(Players.P1)) { scrollRect.verticalNormalizedPosition -= 1f * Time.deltaTime; } break; default: break; } base.Update(); }
void UndoConfirmOption(Joysticks PlayerInput) { switch (PlayerInput) { case Joysticks.White: switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7)) { Player1Selected = false; } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) { Player1Selected = false; } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { Player1Selected = false; } break; case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { Player1Selected = false; } break; case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) { Player1Selected = false; } break; default: break; } Player1Confirmed.enabled = false; break; case Joysticks.Black: switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.Black, Buttons.B7)) { Player2Selected = false; } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.B)) { Player2Selected = false; } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P2, Buttons.B7)) { Player2Selected = false; } break; case SupportedControllers.KeyboardP1ControllerP2: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B)) { Player2Selected = false; } break; case SupportedControllers.KeyboardP2ControllerP1: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7)) { Player2Selected = false; } break; default: break; } Player2Confirmed.enabled = false; break; } }
protected override void Update() { base.Update(); if (ScriptEnabled) { // Root Menu With Buttons if (!IsReplay) { Debug.Log("hi>"); if (Confirm()) { switch (pos) { case 0: Rematch(); break; case 1: ReplaySelected(); break; case 2: ReturnToMenu(); break; default: break; } } if (ValueChanged()) { UpdateDisplay(); } MoveLR(); } else if ((IsReplay) && (!ReplayOptionSelected)) { MoveUD(); if (ValueChanged()) { UpdateReplayDisplay(); } Debug.Log("hi>>"); if (Confirm() && !IsCoR) { switch (pos) { case 0: SelectedGamemode = Gamemodes.Lives; IncrementAmount = 1; Value = 5; minValue = Value; UpdateTextValue(); break; case 1: SelectedGamemode = Gamemodes.Timer; IncrementAmount = 15; Value = 60; minValue = Value; UpdateTextValue(); break; case 2: SelectedGamemode = Gamemodes.SetScore; IncrementAmount = 1000; Value = 1000; minValue = Value; UpdateTextValue(); break; default: break; } ReplayOptionSelected = true; } else if (Return() && !IsCoR) { pos = 1; IsReplay = false; StartCoroutine(InputDelay()); } } else if ((IsReplay) && (ReplayOptionSelected)) { Debug.Log("hi>>>"); if (Confirm() && !IsCoR) { SaveManager.SaveUltimatePinballGamemode((int)SelectedGamemode, IncrementAmount, Value); StartCoroutine(LoadReplay()); } else if (Return() && !IsCoR) { ReplayOptionSelected = false; StartCoroutine(InputDelay()); } } else { Debug.Log("hi"); } } if (IsReplay && ReplayCanvas.alpha != 1) { ReplayCanvas.alpha += Time.deltaTime * 2; } else if (!IsReplay && ReplayCanvas.alpha != 0) { ReplayCanvas.alpha -= Time.deltaTime * 2; } // Updates the amount needed text and revials it if (IsReplay && ReplayOptionSelected && SelectedGamemode != Gamemodes.None) { if (ReplayValueCanvas.alpha != 1) { ReplayValueCanvas.alpha += Time.deltaTime * 2; } switch (ControllerType) { case SupportedControllers.ArcadeBoard: if ((ArcadeControls.JoystickLeft(Joysticks.White) && (!IsCoR))) { if (Value != minValue) { Value -= IncrementAmount; } StartCoroutine(InputDelay()); UpdateTextValue(); } if ((ArcadeControls.JoystickRight(Joysticks.White) && (!IsCoR))) { Value += IncrementAmount; StartCoroutine(InputDelay()); UpdateTextValue(); } break; case SupportedControllers.GamePadBoth: if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR))) { if (Value != minValue) { Value -= IncrementAmount; } StartCoroutine(InputDelay()); UpdateTextValue(); } if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR))) { Value += IncrementAmount; StartCoroutine(InputDelay()); UpdateTextValue(); } break; case SupportedControllers.KeyboardBoth: if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR))) { if (Value != minValue) { Value -= IncrementAmount; } StartCoroutine(InputDelay()); UpdateTextValue(); } if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR))) { Value += IncrementAmount; StartCoroutine(InputDelay()); UpdateTextValue(); } break; case SupportedControllers.KeyboardP1ControllerP2: if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR))) { if (Value != minValue) { Value -= IncrementAmount; } StartCoroutine(InputDelay()); UpdateTextValue(); } if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR))) { Value += IncrementAmount; StartCoroutine(InputDelay()); UpdateTextValue(); } break; case SupportedControllers.KeyboardP2ControllerP1: if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR))) { if (Value != minValue) { Value -= IncrementAmount; } StartCoroutine(InputDelay()); UpdateTextValue(); } if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR))) { Value += IncrementAmount; StartCoroutine(InputDelay()); UpdateTextValue(); } break; default: break; } } else if (IsReplay && !ReplayOptionSelected && ReplayValueCanvas.alpha != 0) { ReplayValueCanvas.alpha -= Time.deltaTime * 2; } }
protected override void Update() { base.Update(); switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Player, Buttons.B1)) { DeflectPowerup(); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(ConvertToPlayers(), ControllerButtons.A)) { DeflectPowerup(); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(ConvertToPlayers(), Buttons.B1)) { DeflectPowerup(); } break; case SupportedControllers.KeyboardP1ControllerP2: if (ConvertToPlayers() == Players.P1) { if (KeyboardControls.ButtonPress(Players.P1, Buttons.B1)) { DeflectPowerup(); } } else { if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { DeflectPowerup(); } } break; case SupportedControllers.KeyboardP2ControllerP1: if (ConvertToPlayers() == Players.P2) { if (KeyboardControls.ButtonPress(Players.P1, Buttons.B1)) { DeflectPowerup(); } } else { if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { DeflectPowerup(); } } break; default: break; } }
protected override void Update() { base.Update(); if (Script_Active) { // Is a Multi Option if (Multi_Option) { // Input if (CanInput) { MenuInput_MultiOption(); } // Update Selected Visual - ( if needed ) if (UpdateSelectedNeeded()) { UpdateSelectedVisuals(); } } else { switch (ControllerType) { case SupportedControllers.ArcadeBoard: if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7) && (Use_Return_Event)) { ReturnEvent.Invoke(); } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { ScreenEvents[0].Invoke(); } break; case SupportedControllers.GamePadBoth: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B) && (Use_Return_Event)) { ReturnEvent.Invoke(); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { ScreenEvents[0].Invoke(); } break; case SupportedControllers.KeyboardBoth: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7) && (Use_Return_Event)) { ReturnEvent.Invoke(); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { ScreenEvents[0].Invoke(); } break; case SupportedControllers.KeyboardP1ControllerP2: if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7) && (Use_Return_Event)) { ReturnEvent.Invoke(); } if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8)) { ScreenEvents[0].Invoke(); } break; case SupportedControllers.KeyboardP2ControllerP1: if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B) && (Use_Return_Event)) { ReturnEvent.Invoke(); } if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A)) { ScreenEvents[0].Invoke(); } break; default: break; } } FadeInCanvasGroup_and_FadeOutThisCanvasGroup(); } }