Пример #1
0
    // Update is called once per frame
    void Update()
    {
        p1 = msl.getP1Score();
        p2 = msl.getP2Score();

        if ((p1 > p2 && PhotonNetwork.player.ID == 1) || (p2 > p1) && PhotonNetwork.player.ID == 2)
        {
            this.gameObject.GetComponent <Text>().text = "あなたのかち!";
        }
        else if ((p1 < p2 && PhotonNetwork.player.ID == 1) || (p2 < p1 && PhotonNetwork.player.ID == 2))
        {
            this.gameObject.GetComponent <Text>().text = "あなたのまけ!";
        }
        else
        {
            this.gameObject.GetComponent <Text>().text = "ひきわけ!";
        }
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Trash")
        {
            audioSource.PlayOneShot(pickTrash);

            //ルンバのオーナーを判別して、それぞれの得点に追加していく
            if (this.photonView.ownerId == 1)
            {
                P1Trash = multiscoremanager.getP1Score();
                P1Trash++;
                multiscoremanager.SetP1Score(P1Trash);
            }
            else
            {
                P2Trash = multiscoremanager.getP2Score();
                P2Trash++;
                multiscoremanager.SetP2Score(P2Trash);
            }

            Debug.Log("P1Trash = " + P1Trash + ", P2Trash = " + P2Trash);
        }
    }