Exemple #1
0
    public void playerScores(string player)
    {
        Player scorer = GameObject.FindGameObjectWithTag(player).GetComponent <Player>();

        scorer.incrementScore();
        m_ballManager.DeleteAllBalls();
        m_lastWinnerPosition = scorer.transform.position;

        if (p1Controller.m_score >= m_maxScore || p2Controller.m_score >= m_maxScore)
        {
            m_winner.text       = player + " wins!";
            m_matchCooldownPrev = Time.fixedTime;
            m_matchCooldown     = true;
            soundWinGame.Play();
        }
        else
        {
            m_winner.text       = player + " scores!";
            m_roundCooldownPrev = Time.fixedTime;
            m_roundCooldown     = true;
            soundWinRound.Play();
        }

        eventMgr.GetComponent <EventManager>().StopAllEvents();
    }