// top bottom // Resume: 0 32 // Movelist: 0 -36 // character select: 889 703 // end Match: 959 633 // 703.7 // Update is called once per frame void Update() { //Dev tool to disable HUDS if (Input.GetKeyDown(KeyCode.BackQuote)) { if (HUD.activeSelf) { HUD.SetActive(false); } else { HUD.SetActive(true); } if (PlayerData.gameMode == "Practice" && PracticeHUD.activeSelf) { PracticeHUD.SetActive(false); } else { PracticeHUD.SetActive(true); } } SetControllers(); if ((GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().gameMode != "Practice" && GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().gameMode != "Tutorial") && allowPause) { if ((Input.GetButtonDown(pauseCode1) || Input.GetButtonDown(pauseCode)) && !isPaused) { DisableControls(true); ActivateMenu(); isPaused = true; optionIndex = -1; optionIndex = 0; quitButtonMatch.Select(); if (Input.GetButtonDown(pauseCode1)) { playerPaused = 1; PlayerIdentifier.text = "P1"; } else if (Input.GetButtonDown(pauseCode)) { playerPaused = 2; PlayerIdentifier.text = "P2"; } } else if (!SceneTransitions.lockinputs && (Input.GetButtonDown(pauseCode1) && isPaused && !moveList && playerPaused == 1) || (Input.GetButtonDown(pauseCode) && isPaused && !moveList && playerPaused == 2)) { DisableControls(false); DeactivateMenu(); isPaused = false; } if (isPaused && !SceneTransitions.lockinputs) { //Handle Vertical Selection if (playerPaused == 1) { vertical = Input.GetAxisRaw(inputVertical); horizontal = Input.GetAxisRaw(inputHorizontal); } else if (playerPaused == 2) { vertical = Input.GetAxisRaw(inputVertical2); horizontal = Input.GetAxisRaw(inputHorizontal2); } //Check for input if (!acceptInputVer) { if (vertical == 0) { acceptInputVer = true; } } if (acceptInputVer && !moveList) { if (vertical < 0) { optionIndex += 1; acceptInputVer = false; if (MarkAnimator.GetCurrentAnimatorStateInfo(0).IsName("MarkAnimation")) { MarkAnimator.Play("MarkAnimation", -1, 0f); } else { MarkAnimator.SetTrigger("PlayMarkAnimation"); } } else if (vertical > 0) { optionIndex -= 1; acceptInputVer = false; if (MarkAnimator.GetCurrentAnimatorStateInfo(0).IsName("MarkAnimation")) { MarkAnimator.Play("MarkAnimation", -1, 0f); } else { MarkAnimator.SetTrigger("PlayMarkAnimation"); } } } if (!acceptInputCirc) { if ((!Input.GetButton(p1circle) && playerPaused == 1) || (!Input.GetButton(p2circle) && playerPaused == 2)) { acceptInputCirc = true; } } if (optionIndex == 4) { optionIndex = 0; } else if (optionIndex == -1) { optionIndex = 3; } if (((Input.GetButton(p1circle) && !moveList && playerPaused == 1) || (Input.GetButton(p2circle) && !moveList && playerPaused == 2)) && acceptInputCirc) { DisableControls(false); DeactivateMenu(); isPaused = false; acceptInputCirc = false; } if (optionIndex == 0) { resumeButtonMatch.Select(); UIBar.transform.localPosition = new Vector2(0, 32); if ((Input.GetButton(p1cross) && playerPaused == 1) || (Input.GetButton(p2cross) && playerPaused == 2)) { DisableControls(false); DeactivateMenu(); isPaused = false; } } else if (optionIndex == 1) { moveListButtonMatch.Select(); UIBar.transform.localPosition = new Vector2(0, -32); if (((Input.GetButtonDown(p1cross) && !moveList && playerPaused == 1) || (Input.GetButtonDown(p2cross) && !moveList && playerPaused == 2)) && acceptMoveList) { MoveList(); acceptBack = false; moveListIndex = 1; verticalMoveListIndex = 1; if (playerPaused == 1) { setMoveListPage(1, PlayerData.GetComponent <SelectedCharacterManager>().P1Character); //print(PlayerData.GetComponent<SelectedCharacterManager>().P1Character == "Achealis"); } else if (playerPaused == 2) { setMoveListPage(1, PlayerData.GetComponent <SelectedCharacterManager>().P2Character); } MoveListMarker.color = new Color(1f, 1f, 1f, 0f); mList.resetMarker(); mList.enableMarker(); //Choose what video to display VideoScreen.GetComponent <UnityEngine.Video.VideoPlayer>().clip = videoToPlay[SelectVideo(verticalMoveListIndex, moveListIndex)];//SelectVideo(verticalMoveListIndex, moveListIndex); } if (!acceptMoveList) { acceptMoveList = true; } if (((Input.GetButton(p1circle) && moveList && playerPaused == 1) || (Input.GetButton(p2circle) && moveList && playerPaused == 2)) && acceptInputCirc) { MoveListBack(); resumeButtonMatch.Select(); acceptInputCirc = false; } //MoveList Interactions if (moveListUI.activeSelf) { MoveListInputs(); } } else if (optionIndex == 2) { characterselectButtonMatch.Select(); UIBar.transform.localPosition = new Vector2(0, -94); if ((Input.GetButton(p1cross) && playerPaused == 1) || (Input.GetButton(p2cross) && playerPaused == 2)) { ReturntoCharacterSelect(); } } else if (optionIndex == 3) { quitButtonMatch.Select(); UIBar.transform.localPosition = new Vector2(0, -163); if ((Input.GetButton(p1cross) && playerPaused == 1) || (Input.GetButton(p2cross) && playerPaused == 2)) { QuitToMenu(); } } } } //Handle Practice Mode Pause Menu else if (GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().gameMode == "Practice" || GameObject.Find("PlayerData").GetComponent <SelectedCharacterManager>().gameMode == "Tutorial") { if (Input.GetButtonDown(pauseCode1) && !isPaused) { playerPaused = 1; DisableControls(true); ActivateMenu(); isPaused = true; optionIndex = -1; optionIndex = 0; quitButton.Select(); } else if (Input.GetButtonDown(pauseCode1) && isPaused && !moveList) { DisableControls(false); DeactivateMenu(); isPaused = false; } if (isPaused && !SceneTransitions.lockinputs) { //Handle Vertical Selection vertical = Input.GetAxisRaw(inputVertical); //Check for input if (!acceptInputVer) { if (vertical == 0) { acceptInputVer = true; } } if (acceptInputVer && !moveList) { if (vertical < 0) { optionIndex += 1; acceptInputVer = false; } else if (vertical > 0) { optionIndex -= 1; acceptInputVer = false; } } if (!acceptInputCirc) { if (!Input.GetButton(p1circle)) { acceptInputCirc = true; } } //Check Horizontal Input horizontal = Input.GetAxisRaw(inputHorizontal); if (!acceptInputHor) { if (horizontal == 0) { acceptInputHor = true; } } //Timer for holding a horizontal input if (horizontal > 0 || horizontal < 0) { if (inputTimer == 1) { holdScroll = true; inputTimer++; } else if (inputTimer < 30) { inputTimer++; holdScroll = false; } else { holdScroll = true; } } else { inputTimer = 0; holdScroll = false; } //Cycle option scrolling //optionIndex scrolling if (optionIndex == 10) { optionIndex = 0; } else if (optionIndex == -1) { optionIndex = 9; } if (Input.GetButton(p1circle) && !moveList && acceptInputCirc) { DisableControls(false); DeactivateMenu(); isPaused = false; acceptInputCirc = false; } //Resume Button if (optionIndex == 0) { resumeButton.Select(); if (Input.GetButton(p1cross)) { DisableControls(false); DeactivateMenu(); isPaused = false; } } //CPU Action else if (optionIndex == 1) { CPUStateHighlight.Select(); if (acceptInputHor) { if (horizontal < 0) { CPUState -= 1; acceptInputHor = false; } else if (horizontal > 0) { CPUState += 1; acceptInputHor = false; } } } //P1 Health else if (optionIndex == 2) { P1ValorHighlight.Select(); if (holdScroll) { if (horizontal < 0) { P1Valor -= 1; } else if (horizontal > 0) { P1Valor += 1; } } } //P2 Health else if (optionIndex == 3) { P2ValorHighlight.Select(); if (holdScroll) { if (horizontal < 0) { P2Valor -= 1; } else if (horizontal > 0) { P2Valor += 1; } } } //Armor Refill else if (optionIndex == 4) { armorRefillHighlight.Select(); if (acceptInputHor) { if (horizontal < 0) { ArmorRefill -= 1; acceptInputHor = false; } else if (horizontal > 0) { ArmorRefill += 1; acceptInputHor = false; } } } //CPU Air Tech else if (optionIndex == 5) { CPUAirTechHighlight.Select(); if (acceptInputHor) { if (horizontal < 0) { CPUAirRecover -= 1; acceptInputHor = false; } else if (horizontal > 0) { CPUAirRecover += 1; acceptInputHor = false; } } } //CPU Ground Guard else if (optionIndex == 6) { CPUGuardAfterFirstHithHighlight.Select(); if (acceptInputHor) { if (horizontal < 0) { CPUGroundGuard -= 1; acceptInputHor = false; } else if (horizontal > 0) { CPUGroundGuard += 1; acceptInputHor = false; } } } //Character Select Button else if (optionIndex == 7) { characterselectButton.Select(); if (Input.GetButton(p1cross)) { ReturntoCharacterSelect(); } } //MoveList else if (optionIndex == 8) { moveListButton.Select(); if (Input.GetButtonDown(p1cross) && !moveList) { MoveList(); acceptBack = false; moveListIndex = 1; verticalMoveListIndex = 1; mList.setDhaliaPage1(); MoveListMarker.color = new Color(1f, 1f, 1f, 0f); mList.resetMarker(); mList.enableMarker(); //Choose what video to display VideoScreen.GetComponent <UnityEngine.Video.VideoPlayer>().clip = videoToPlay[SelectVideo(verticalMoveListIndex, moveListIndex)];//SelectVideo(verticalMoveListIndex, moveListIndex); } if (!acceptMoveList) { acceptMoveList = true; } if (Input.GetButton(p1circle) && moveList && acceptInputCirc) { MoveListBack(); resumeButton.Select(); acceptInputCirc = false; } if (moveListUI.activeSelf) { MoveListInputs(); } } //Quit Button else if (optionIndex == 9) { quitButton.Select(); if (Input.GetButton(p1cross)) { QuitToMenu(); } } //Options scrolling //CPUState scrolling if (CPUState == 8) { CPUState = 0; } else if (CPUState == -1) { CPUState = 7; } //Valor scrolling if (P1Valor == 101) { P1Valor = 1; } else if (P1Valor == 0) { P1Valor = 100; } if (P2Valor == 101) { P2Valor = 1; } else if (P2Valor == 0) { P2Valor = 100; } //ArmorRefill scrolling if (ArmorRefill == 2) { ArmorRefill = 0; } else if (ArmorRefill == -1) { ArmorRefill = 1; } //CPU Air Recovery if (CPUAirRecover == 2) { CPUAirRecover = 0; } else if (CPUAirRecover == -1) { CPUAirRecover = 1; } //CPU Ground Guard if (CPUGroundGuard == 2) { CPUGroundGuard = 0; } else if (CPUGroundGuard == -1) { CPUGroundGuard = 1; } //Update Text for options switch (CPUState) { case 0: CPUStateText.GetComponent <TMPro.TextMeshProUGUI>().text = "Stand"; break; case 1: CPUStateText.GetComponent <TMPro.TextMeshProUGUI>().text = "Crouch"; break; case 2: CPUStateText.GetComponent <TMPro.TextMeshProUGUI>().text = "Jump"; break; case 3: CPUStateText.GetComponent <TMPro.TextMeshProUGUI>().text = "Standing Guard"; break; case 4: CPUStateText.GetComponent <TMPro.TextMeshProUGUI>().text = "Crouching Guard"; break; case 5: CPUStateText.GetComponent <TMPro.TextMeshProUGUI>().text = "Guard All"; break; case 6: CPUStateText.GetComponent <TMPro.TextMeshProUGUI>().text = "CPU"; break; case 7: CPUStateText.GetComponent <TMPro.TextMeshProUGUI>().text = "Player"; break; } P1ValorText.GetComponent <TMPro.TextMeshProUGUI>().text = "" + P1Valor + "%"; P2ValorText.GetComponent <TMPro.TextMeshProUGUI>().text = "" + P2Valor + "%"; switch (ArmorRefill) { case 0: ArmorRefillText.GetComponent <TMPro.TextMeshProUGUI>().text = "On"; break; case 1: ArmorRefillText.GetComponent <TMPro.TextMeshProUGUI>().text = "Off"; break; } switch (CPUAirRecover) { case 0: CPUAirRecoverText.GetComponent <TMPro.TextMeshProUGUI>().text = "Off"; break; case 1: CPUAirRecoverText.GetComponent <TMPro.TextMeshProUGUI>().text = "On"; break; } switch (CPUGroundGuard) { case 0: CPUGroundGuardText.GetComponent <TMPro.TextMeshProUGUI>().text = "Off"; break; case 1: CPUGroundGuardText.GetComponent <TMPro.TextMeshProUGUI>().text = "On"; break; } } } }