private void SelectMenuButton() { buttonsEnabled = false; audioSource.PlayOneShot(clipSelect); StartCoroutine(GenericFunctions.FadeOutSound(.75f, audioSource, 0f)); switch (buttonIndex) { case 0: StartCoroutine(GenericFunctions.FadeInImage(.75f, fadeImage, "CharacterSelection")); break; case 1: StartCoroutine(GenericFunctions.FadeInImage(.75f, fadeImage, "Credits")); break; case 2: Debug.Log("Exit Game"); StartCoroutine(GenericFunctions.FadeInImage(.75f, fadeImage, "")); break; default: Debug.Log("MainMenuManager: error en SelectMenuButton"); break; } }
// Update is called once per frame private void Update() { if (PlayerInputs.GetKeyDown(Constants.PLAYER_1_TAG, Constants.ESCAPE)) { StartCoroutine(GenericFunctions.FadeOutSound(.75f, audioSource, 0f)); StartCoroutine(GenericFunctions.FadeInImage(.75f, fadeImage, "MainMenu")); } if (player1selected && player2selected) { if (!fading) { StartCoroutine(GenericFunctions.FadeInImage(1.5f, fadeImage, "Stage1")); fading = true; } return; } timer -= Time.deltaTime; if (timer < 0) { SelectCharacterPlayer1(); SelectCharacterPlayer2(); } timerText.text = ((int)timer).ToString(); if (PlayerInputs.GetKeyDown(Constants.PLAYER_1_TAG, Constants.LEFTH) && !player1selected) { PreviousCharacterPlayer1(); } if (PlayerInputs.GetKeyDown(Constants.PLAYER_1_TAG, Constants.RIGHT) && !player1selected) { NextCharacterPlayer1(); } if (PlayerInputs.GetKeyDown(Constants.PLAYER_2_TAG, Constants.LEFTH) && !player2selected) { PreviousCharacterPlayer2(); } if (PlayerInputs.GetKeyDown(Constants.PLAYER_2_TAG, Constants.RIGHT) && !player2selected) { NextCharacterPlayer2(); } if (PlayerInputs.GetKeyDown(Constants.PLAYER_1_TAG, Constants.SELECT) && !player1selected) { SelectCharacterPlayer1(); } if (PlayerInputs.GetKeyDown(Constants.PLAYER_2_TAG, Constants.SELECT) && !player2selected) { SelectCharacterPlayer2(); } }
// Update is called once per frame void Update() { if (PlayerInputs.GetKeyDown(Constants.PLAYER_1_TAG, Constants.ESCAPE) || PlayerInputs.GetKeyDown(Constants.PLAYER_1_TAG, Constants.SELECT) || PlayerInputs.GetKeyDown(Constants.PLAYER_1_TAG, Constants.ATTACK)) { audioSource.PlayOneShot(clipSelect); StartCoroutine(GenericFunctions.FadeOutSound(.75f, audioSource, 0f)); StartCoroutine(GenericFunctions.FadeInImage(.75f, fadeImage, "MainMenu")); buttonsEnabled = false; } }