https://doc.photonengine.com/ko-kr/pun/v2/demos-and-tutorials/pun-basics-tutorial/player-prefab


캐릭터 프리펩을 만들기 위한 애니메이션, 입력 관련이 주된내용으로 관련 내용은 따로 포스팅을 해보자


이번 장에서 사용한 포톤 관련 클래스는 PhotonView 클래스로 해당 오브젝트가 클라이언트의 소유인지 확인 할 수 있다


bool PhotonView.isMine
get

True if the PhotonView is "mine" and can be controlled by this client.

PUN has an ownership concept that defines who can control and destroy each PhotonView. True in case the owner matches the local PhotonPlayer. True if this is a scene photonview on the Master client.

https://doc-api.photonengine.com/en/pun/current/class_photon_view.html


아래와 같이 빔에 맞았을 때 본인의 캐릭터일때만 hp를 깍게 되어있다


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
void OnTriggerEnter(Collider other)
        {
            if (!photonView.IsMine)
            {
                return;
            }
 
            if (!other.name.Contains("Beam"))
            {
                return;
            }
            Health -= 0.1f;
        }
 
        void OnTriggerStay(Collider other)
        {
 
            if (!photonView.IsMine)
            {
                return;
            }
 
            if (!other.name.Contains("Beam"))
            {
                return;
            }
   
            Health -= 0.1f * Time.deltaTime;
        }
cs







+ Recent posts