public PhotonView PV; public GameObject Owner; void Start() { Owner = ((GameObject)PN.LocalPlayer.TagObject); //Owner ์ฐพ๋ ์คํฌ๋ฆฝํธ Destroy(gameObject, 1.5f); } void Update() { transform.Translate(Vector3.right * 20 * Time.deltaTime * dir); } void OnTriggerEnter2D(Collider2D col) { if (col.tag == "Ground") PV.RPC("DestroyRPC", RpcTarget.AllBuffered); if (!PV.IsMine && col.tag == "Player" && col.GetComponent<PhotonView>().IsMine) { col.GetComponent<PlayerScript>().Hit(); PV.RPC("DestroyRPC", RpcTarget.AllBuffered); Charge(); } } void Charge() { Owner.SendMessage("GoodShot"); }
๋ด๊ฐ ๋ง๋ค๊ณ ์ถ์๊ฑด ์ด์์ด ์ (!PV.IsMine)์ ๋ง์ถ ๋๋ง๋ค ๋ด ์บ๋ฆญํฐ(Owner)์ GoodShot ํจ์๊ฐ ํธ์ถ๋๋๊ฑฐ์
Owner๊ฐ ์ ์บ๋ฆญํฐ ์ค๋ธ์ ํธ๋ก ๋ผ์๋ ๊ฒ๋ ์๋๋ฐย ์์ํ๊ฒย ๋ด ์บ๋ฆญํฐ์ GoodShot ํจ์๊ฐ ์๋๋ผ
์ ์บ๋ฆญํฐ ์ค๋ธ์ ํธ์ GoodShot ํจ์๊ฐ ํธ์ถ๋จ
์ด์บ
๋๋ ๋ฐ๋ฏธ์ง๊ฐ์ด ์ค์ํ ์ถฉ๋์ด๋ฉด physics๋ค์ด๊ฐ์ ๋ ์ด์ด ์ค์ ๋คํด๋๊ธดํจ ์ํ๋์ด๋ ์ถฉ๋๋ชปํ๊ฒ
- ์ ํ๋ ์ด์ด col.tag == "Player" && false == col.GetComponent().IsMine - Bullet์ ์ฃผ์ธ PV.IsMine
ํ ๊ณ ๋ง์ ์ฌ๋ํด