Ejemplo n.º 1
0
    IEnumerator RoundRunning()
    {
        while (RoundCountDown >= 0)
        {
            if (RoundCountDown <= 30)
            {
                m_Hazard.SetHazard(PrevLight1); // begin hazard
            }
            if (Time.timeScale == 0)
            {
                pausePlayers();
                RoundCountDown -= 0;
            }
            else
            {
                unpausePlayers();
                RoundCountDown -= Time.deltaTime;
            }
            m_TimerCanvas.text = RoundCountDown.ToString("f2");
            yield return(null);
        }
        m_Hazard.SetHazard(6); // stop the hazard
        m_RoundOverImage.SetActive(true);
        audio.clip = m_RoundEndAudio;
        if (audio.isPlaying == false)
        {
            audio.Play();
        }
        StartCoroutine(TurnOffPlayerControls());

        yield return(new WaitForSeconds(2.0f));

        RoundEnd();
        yield return(new WaitForSeconds(3.0f));

        ResetBottles();
        if (Player1Score == 2)
        {
            EndGamePlayerWinner(1);
            yield return(new WaitForSeconds(2.0f));

            m_managerScript.P1DeathTxt(Player1Death);
            m_managerScript.P2DeathText(Player2Death);
            m_managerScript.WinnerIcon(1);
        }
        else if (Player2Score == 2)
        {
            EndGamePlayerWinner(2);
            yield return(new WaitForSeconds(2.0f));

            m_managerScript.P1DeathTxt(Player1Death);
            m_managerScript.P2DeathText(Player2Death);
            m_managerScript.WinnerIcon(2);
        }
        else if (Player1Score != 2 && Player2Score != 2)
        {
            ResetRound();
        }
    }