From 6b8725f0f80887c468610d88b39a18b0bbb15740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=90=8D?= <3077614386@qq.com> Date: Sun, 21 Jan 2024 17:05:14 +0800 Subject: [PATCH] 1 --- .../Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs index aa0e349b..0797d9b7 100644 --- a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs +++ b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs @@ -160,7 +160,7 @@ public class UnmannedAerialVehicle : MonoBehaviour HighPriorityTarget highPriorityTarget = _transform.GetComponent(); if (highPriorityTarget ) { - highPriorityTarget.BeAssaulted(transform.position, true); + highPriorityTarget.BeAssaulted(atkPos, true); } GameObject Bao = Instantiate(explodePrefab, _transform); @@ -246,6 +246,7 @@ public class UnmannedAerialVehicle : MonoBehaviour } } + Vector3 atkPos = new Vector3(); /// /// 远程攻击 @@ -260,11 +261,14 @@ public class UnmannedAerialVehicle : MonoBehaviour obj.SetActive(true); //Rigidbody rb = obj.GetComponent(); //rb.AddForce(bulletPoint.forward * 20f, ForceMode.Impulse); - obj.transform.DOMove(v3, 2).SetEase(Ease.Linear); + obj.transform.DOMove(v3, 2).SetEase(Ease.Linear).OnComplete(() => { + Destroy(obj); + }); ShellBoom sb = obj.AddComponent(); sb.isPlayer = unmannedAerialVehicleManage.equipmentCommon.isPlayer; sb.onShellAttack.AddListener(() => { + atkPos = sb.transform.position; AddBao(attackTarget.transform); // 销毁objectToDestroy对象 //BeAssaulted("攻击到目标");