Ejemplo n.º 1
0
        void CmdFire()
        {
            // Create the Bullet from the Bullet Prefab
            var bullet = PhotonNetwork.Instantiate(
                "Bullet",
                bulletSpawn.position,
                bulletSpawn.rotation,
                0);

            // Play sound of gun shooting
            NetworkAudio.SendPlayClipAtPoint(fireGunSound, transform.position, 1.0f);
        }
Ejemplo n.º 2
0
        void OnCollisionEnter(Collision collision)
        {
            var hit = collision.gameObject;

            // Very stupid check to see if we're hitting a gun
            if (hit.GetComponent <Gun>() != null)
            {
                return;
            }

            if (PhotonNetwork.isMasterClient)
            {
                PhotonNetwork.Destroy(gameObject);
                NetworkAudio.SendPlayClipAtPoint(hitSolidSound, transform.position, 1.0f);
            }
        }