コード例 #1
0
 private void SetupOtherPlayer()     //다른 유저의 정보는 UI 정보버튼에 등록.
 {
     GameObject[] buttons = GameObject.FindGameObjectsWithTag("Button");
     foreach (GameObject i in buttons)
     {
         UserUIButton userui = i.GetComponent <UserUIButton> ();   //UI 정보 버튼
         if (userui != null && userui.target == null)              // UI 정보버튼을 불러왔고, target이 정해져있지 않을때(타 유저 정보가 등록됨);
         {
             userui.init(this.GetComponent <Transform>());
             otherHealth = userui.SyncHealthBar;                //유저정보에 표기되는 HPGauge 변경 함수를 otherhealth 델리게이트에 등록
             // 이제 유저가 피해를 입었을 때 로컬유저가 아니면 자동으로 UI의 hp게이지를 조절함.
             return;
         }
     }
 }
コード例 #2
0
 public override void OnPointerDown(PointerEventData pEvent)
 {
     if (player != null && target != null)
     {
         UserUIButton who = UserUIButtonMon.isPressed();
         if (who == null)              //None Pressed
         {
             player.DimensionSupportTarget = this;
             isPressed = true;
             GetComponent <Image> ().color = Color.gray;
         }
         else if (who == this)               //this Pressed
         {
             player.DimensionSupportTarget = null;
             isPressed = false;
             GetComponent <Image> ().color = Color.white;
         }            //otherPressed
     }
 }