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(); 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() { // 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(); }
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; } }
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) }
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(); 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; } }
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; } } } }
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); } }
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); } }
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()); } }
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(); } }
private void Update() { if (!SelectionPopupMenu.activeInHierarchy) { UpdateDisplay(); if ((ArcadeControls.JoystickLeft(Joysticks.White)) && (IsAbleToSwitch)) { if (Hovered == 0) { Hovered = (MaxSelections); } else { --Hovered; } UpdateDisplay(); StartCoroutine(DelayToChange()); } if ((ArcadeControls.JoystickRight(Joysticks.White)) && (IsAbleToSwitch)) { if (Hovered == (MaxSelections)) { Hovered = 0; } else { ++Hovered; } UpdateDisplay(); StartCoroutine(DelayToChange()); } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { RunSelection(); } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7)) { SelectionPopupMenu.SetActive(false); } } else { // Replay with different (Open menu) if (!SelectionMade) { UpdateTextDisplayOnPopup(); if ((ArcadeControls.JoystickDown(Joysticks.White)) && (IsAbleToSwitch)) { if (Hovered == (MaxSelections)) { Hovered = 0; } else { ++Hovered; } UpdateTextDisplayOnPopup(); StartCoroutine(DelayToChange()); } if ((ArcadeControls.JoystickUp(Joysticks.White)) && (IsAbleToSwitch)) { if (Hovered == 0) { Hovered = (MaxSelections); } else { --Hovered; } UpdateTextDisplayOnPopup(); StartCoroutine(DelayToChange()); } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { NewMode = (GameManager.GameTypes)(Hovered + 1); SelectionMade = true; } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7)) { SelectionPopupMenu.SetActive(false); } HowManyText.enabled = false; HowManyNumberText.enabled = false; DefaultNumberValue = false; } // lives, timer or score selected.... else { if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B1)) { ++SelectionInt; } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B2)) { --SelectionInt; } if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7)) { SelectionMade = false; } HowManyText.enabled = true; HowManyNumberText.enabled = true; // Update text & diaply of text while it is still been changed switch (NewMode) { case GameManager.GameTypes.Lives: if (!DefaultNumberValue) { SelectionInt = 3; DefaultNumberValue = true; } HowManyText.text = "How Many Lives?"; HowManyNumberText.text = SelectionInt.ToString(); break; case GameManager.GameTypes.Timer: if (!DefaultNumberValue) { SelectionInt = 60; DefaultNumberValue = true; } HowManyText.text = "How Long?"; string Mins = (SelectionInt / 60).ToString("00"); string Sec = (SelectionInt % 60).ToString("00"); HowManyNumberText.text = Mins + ":" + Sec; break; case GameManager.GameTypes.SetScore: if (!DefaultNumberValue) { SelectionInt = 1000; DefaultNumberValue = true; } HowManyText.text = "Target Score?"; HowManyNumberText.text = SelectionInt.ToString(); break; default: break; } // if confirm pressed - send info and reload scene if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8)) { switch (NewMode) { case GameManager.GameTypes.Lives: PlayerPrefs.SetFloat("Pinball-Lives", SelectionInt); SelectionInt = 0; SelectionMade = false; SelectionPopupMenu.SetActive(false); PlayerPrefs.SetInt("Pinball-Gametype", (int)GameManager.GameTypes.Lives); SceneManager.LoadSceneAsync("BallGame"); break; case GameManager.GameTypes.Timer: PlayerPrefs.SetFloat("Pinball-Timer", SelectionInt); SelectionInt = 0; SelectionMade = false; SelectionPopupMenu.SetActive(false); PlayerPrefs.SetInt("Pinball-Gametype", (int)GameManager.GameTypes.Timer); SceneManager.LoadSceneAsync("BallGame"); break; case GameManager.GameTypes.SetScore: PlayerPrefs.SetFloat("Pinball-SetScore", SelectionInt); SelectionInt = 0; SelectionMade = false; SelectionPopupMenu.SetActive(false); PlayerPrefs.SetInt("Pinball-Gametype", (int)GameManager.GameTypes.SetScore); SceneManager.LoadSceneAsync("BallGame"); 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; } }
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(); } }