Beispiel #1
0
        private void SpawnLocalPlayer()
        {
            // we're in a room. spawn a character for the local player. it gets synced by using PhotonNetwork.Instantiate
            if (MasterNetAdapter.NetLib == NetworkLibrary.PUN)
            {
                Transform  tr  = NSTSamplePlayerSpawn.GetRandomSpawnPoint();
                Vector3    pos = (tr) ? tr.position : Vector3.zero;
                Quaternion rot = (tr) ? tr.rotation : Quaternion.identity;

                MasterNetAdapter.Spawn(playerPrefab, pos, rot, null);
            }
        }
Beispiel #2
0
        private void SpawnLocalPlayer()
        {
            // we're in a room. spawn a character for the local player. it gets synced by using PhotonNetwork.Instantiate
            if (MasterNetAdapter.NetLib == NetworkLibrary.PUN || NSTNetAdapter.NetLibrary == NetworkLibrary.PUN2)
            {
                if (playerPrefab)
                {
                    Transform  tr  = NSTSamplePlayerSpawn.GetRandomSpawnPoint();
                    Vector3    pos = (tr) ? tr.position : Vector3.zero;
                    Quaternion rot = (tr) ? tr.rotation : Quaternion.identity;

                    localPlayer = MasterNetAdapter.Spawn(playerPrefab, pos, rot, null);
                }
                else
                {
                    Debug.LogError("No PlayerPrefab defined in " + this.GetType().Name);
                }
            }
        }