void SyncPlayerHpBarResponse(int hp, int hurtNum, int targetid) { GameObject playerGo = null; PlayerController.Instance.transPlayerDict.TryGetValue(targetid, out playerGo); if (playerGo != null) { PlayerAttack playerAttack = playerGo.GetComponent <PlayerAttack>(); //playerAttack.ShowHurtNum(hurtNum);//1.显示伤害数字 //更新Player的HP值 playerAttack.hp = hp; //如果HP为0,则调用死亡 if (hp <= 0) { playerAttack.Dead(); } if (targetid == PhotonEngine.Instance.role.ID) { //2.被攻击对象所属客户端才会显示受伤红屏效果 BloodScreen.Instance.ShowBloodScreen(); playerAttack.UpdatePlayerHpBar(hp); } } }