-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTakePermission.cs
41 lines (34 loc) · 1.16 KB
/
TakePermission.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class TakePermission : MonoBehaviourPunCallbacks
{
private Rigidbody rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
//başlangıçta RPC kullanılmasının sebebi sceneobjectler üretildikten sonra isim değiştiğinde sadece masterda gözüküyor
//sceneobject üretmemizin sebebi ise oyuncu disconnect olduğunda karakterinin silinmesini istemiyoruz hızlı dc and rc den sonra karakterine istediği gibi devam edebilmeli
photonView.RPC("changeName_Tag",RpcTarget.AllBufferedViaServer,this.name,this.tag);
}
private void OnMouseDown()
{
base.photonView.RequestOwnership();
}
// Update is called once per frame
void Update()
{
if (base.photonView.Owner == PhotonNetwork.LocalPlayer)
{
}
}
[PunRPC]
public void changeName_Tag(string name,string tag)
{
transform.name = name;
transform.tag = tag;
}
}