Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Time.time > repeat_search_time)
        {
            Debug.Log("Repeating frog score search...");

            repeat_search_time += period;

            if (!frog1 || !sc1)
            {
                LookForFrog(1);
            }

            if (!frog2 || !sc2)
            {
                LookForFrog(2);
            }
        }

        // Update labels if needed
        if (sc1 && sc1.GetIfScoreChanged())
        {
            score_text1.text = sc1.score.ToString();
            sc1.ScoreLabelUpdated();

            if (sc1.score == WIN_POINTS)
            {
                endGame.EndGame(PhotonNetwork.IsMasterClient ? "You\nWIN" : "You\nlose");
            }
        }

        if (sc2 && sc2.GetIfScoreChanged())
        {
            score_text2.text = sc2.score.ToString();
            sc2.ScoreLabelUpdated();

            if (sc2.score == WIN_POINTS)
            {
                endGame.EndGame(!PhotonNetwork.IsMasterClient ? "You\nWIN" : "You\nlose");
            }
        }
    }