示例#1
0
    //PLAYER WIN
    IEnumerator winTextCoroutine() //BUG goinng through winTextCoroutine Twice
    {
        Debug.Log("WinTextCoroutine");

        if (oHealthBar.playerHealth <= 0)   // if O health = 0 ... X WINS!
        {
            Debug.Log("X WINS!");
            FindObjectOfType <AudioManager>()?.StopPlaying(Sound.SoundType.Battle);
            FindObjectOfType <AudioManager>()?.Play(Sound.SoundType.Victory);
            FindObjectOfType <AudioManager>()?.Play(Sound.SoundType.XWin_VO);


            transitionScreen.gameObject.SetActive(true);
            winText.gameObject.SetActive(true);
            resetGame.gameObject.SetActive(true);
            StopCoroutine(winTextCoroutine()); // STOP Coroutine
            yield return(null);
        }

        else if (xHealthBar.playerHealth <= 0)  // if X health = 0 ... O WINS!
        {
            Debug.Log("O WINS!");
            FindObjectOfType <AudioManager>()?.StopPlaying(Sound.SoundType.Battle);
            FindObjectOfType <AudioManager>()?.Play(Sound.SoundType.Victory);
            FindObjectOfType <AudioManager>()?.Play(Sound.SoundType.OWin_VO);

            transitionScreen.gameObject.SetActive(true);
            winText.gameObject.SetActive(true);
            resetGame.gameObject.SetActive(true);
            StopCoroutine(winTextCoroutine()); // STOP Coroutine
            yield return(null);
        }

        else
        {
            Debug.Log("3 Second TRANSITION...");
            transitionScreen.gameObject.SetActive(true);
            yield return(new WaitForSeconds(3));

            resetGame.Reset();
            transitionScreen.gameObject.SetActive(false);
        }
        // Debug.Log("PlayerWin: " + playerWin);
        yield return(null);
    }
示例#2
0
 public void ResetGame()
 {
     resetGame.Reset(stateMachineManager.player.spawnedPlayer, inputManager.anchorHandler.visualAnchorClone, inputManager.anchorHandler.mainAnchor);
 }