Beispiel #1
0
    void OnCollisionExit2D(Collision2D other)
    {
        if (other.gameObject.GetComponents <GlassBall>().Length > 0)
        {
            GlassBall other_ball = other.gameObject.GetComponent <GlassBall>();

            int photon_view_id = other_ball.GetComponent <PhotonView>().viewID;
            if (!PhotonNetwork.connected || PhotonNetwork.connected && PhotonNetwork.isMasterClient)
            {
                other_ball.Accelerate(reflectivity);
            }

            if (pum.TripleShotQueued)
            {
                other_ball.SetTripleShot();
                pum.DeQueueTripleShot();
            }

            if (PhotonNetwork.connected)
            {
                if (photon_view.isMine)
                {
                    audio_source.Play();
                    photon_view.RPC("DecreaseHitPoint", PhotonTargets.AllBufferedViaServer, photon_view_id);
                }
                else
                {
                    audio_source.PlayOneShot(bounce_other);
                }
            }
            else if (!PhotonNetwork.connected)
            {
                DecreaseHitPoint();
                audio_source.Play();
            }
        }
    }