예제 #1
0
 // Start is called before the first frame update
 void Start()
 {
     iam      = this.GetComponent <PhotonView>();
     ingameui = GameObject.FindGameObjectWithTag("InGameUI").GetComponent <InGameUI>();
     if (iam.IsMine)
     {
         ingameui.SetHp(count_live);
     }
 }
예제 #2
0
    public void ApplyPlayerDamage(float dmg, Photon.Realtime.Player attacker, string source)
    {
        //if (attacker.GetTeam() == PunTeams.Team.none && attacker != PhotonNetwork.LocalPlayer)
        {
            //Debug.Log(attacker.NickName + " dealt " + dmg + " damage" + " with ");
            if (count_live > 0)
            {
                count_live -= dmg;
                if (iam.IsMine)
                {
                    if (count_live <= 0)
                    {
                        //Debug.Log("tur");

                        count_live = 0;
                        iam.RPC("OnPlayerKilled", RpcTarget.All, attacker, PhotonNetwork.LocalPlayer.NickName, source);
                    }
                    ingameui.SetHp(count_live);
                }
            }
        }
    }