Exemple #1
0
 private void Start()
 {
     peerConnectionManager = NetworkScene.FindNetworkScene(this).
                             GetComponentInChildren <VoipPeerConnectionManager>();
     if (peerConnectionManager)
     {
         peerConnectionManager.OnPeerConnection.AddListener(OnPeerConnection, true);
     }
 }
Exemple #2
0
 /// <summary>
 /// Find the AvatarManager for forest the Component is a member of. May return null if there is no AvatarManager for the scene.
 /// </summary>
 public static AvatarManager Find(MonoBehaviour Component)
 {
     try
     {
         return(NetworkScene.FindNetworkScene(Component).GetComponentInChildren <AvatarManager>());
     }
     catch
     {
         return(null);
     }
 }
Exemple #3
0
 /// <summary>
 /// Find the VoipConnectionManager for forest the Component is a member of. May return null if there is no Voip manager for the scene.
 /// </summary>
 public static VoipPeerConnectionManager Find(MonoBehaviour Component)
 {
     try
     {
         return(NetworkScene.FindNetworkScene(Component).GetComponentInChildren <VoipPeerConnectionManager>());
     }
     catch
     {
         return(null);
     }
 }
Exemple #4
0
        private bool TryGetAvatarManager(out AvatarManager avatarManager)
        {
            try {
                avatarManager = NetworkScene.FindNetworkScene(this)
                                .GetComponentInChildren <AvatarManager>();
            }
            catch (System.NullReferenceException)
            {
                avatarManager = null;
            }

            return(avatarManager);
        }
Exemple #5
0
        private void SetTexture(Texture2D texture)
        {
            if (!networkScene)
            {
                networkScene = NetworkScene.FindNetworkScene(this);
                if (!networkScene)
                {
                    return;
                }
            }

            var avatar         = networkScene.GetComponentInChildren <AvatarManager>().LocalAvatar;
            var texturedAvatar = avatar.GetComponent <TexturedAvatar>();

            if (texturedAvatar)
            {
                texturedAvatar.SetTexture(texture);
            }
        }
Exemple #6
0
        public static void ChangeScene(MonoBehaviour caller, string sceneName)
        {
            var manager = FindSceneManager(NetworkScene.FindNetworkScene(caller));

            manager.ChangeScene(sceneName);
        }
Exemple #7
0
        public static GameObject SpawnPersistent(MonoBehaviour caller, GameObject prefab)
        {
            var spawner = FindNetworkSpawner(NetworkScene.FindNetworkScene(caller));

            return(spawner.SpawnPersistent(prefab));
        }