public void NetBeAttacked(float att, GameObject attackTank) { Debug.LogError("123213"); if (Hp <= 0) { return; } if (Hp > 0) { Hp -= att; } if (Hp <= 0) { ctrlType = CtrlType.none; GameObject destoryObj = (GameObject)Instantiate(destoryEffect); destoryObj.transform.SetParent(transform, false); destoryObj.transform.localPosition = Vector3.zero; //播放击杀提示 if (attackTank != null) { tankcontrol tankcmp = attackTank.GetComponent <tankcontrol>(); if (tankcmp != null && tankcmp.ctrlType == CtrlType.player) { tankcmp.startDrawKill(); } } } }
//击中目标 public void BeAttacked(float att, GameObject attackTank) { if (Hp <= 0) { return; } Hp -= att; if (ai != null) { ai.OnAttecked(attackTank); } if (Hp <= 0) { Battle.instance.IsWin(attackTank); Debug.Log(attackTank); GameObject destoryObj = (GameObject)Instantiate(destoryEffect); destoryObj.transform.SetParent(transform, false); destoryObj.transform.localPosition = Vector3.zero; ctrlType = CtrlType.none; if (attackTank != null) { tankcontrol Tankcmp = attackTank.GetComponent <tankcontrol>(); if (Tankcmp != null && Tankcmp.ctrlType == CtrlType.player) { Tankcmp.startDrawKill(); } } } }