Esempio n. 1
0
        public static void RefreshInstance(ref PlayerNetwork player, PlayerNetwork Prefab)
        {
            var position = Vector3.zero;
            var rotation = Quaternion.identity;

            if (player != null)
            {
                position = player.transform.position;
                rotation = player.transform.rotation;
                PhotonNetwork.Destroy(player.gameObject);
            }

            player = PhotonNetwork.Instantiate(Prefab.gameObject.name, position, rotation).GetComponent <PlayerNetwork>();
        }
Esempio n. 2
0
 public override void OnPlayerEnteredRoom(Photon.Realtime.Player newPlayer)
 {
     PlayerNetwork.RefreshInstance(ref LocalPlayer, PlayerPrefab);
 }
Esempio n. 3
0
 void Start()
 {
     PlayerNetwork.RefreshInstance(ref LocalPlayer, PlayerPrefab);
 }