diff --git a/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab b/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab index 98448638..32cc81f0 100644 --- a/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab +++ b/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab @@ -231,7 +231,7 @@ SphereCollider: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1868832759} m_Material: {fileID: 0} - m_IsTrigger: 0 + m_IsTrigger: 1 m_Enabled: 1 serializedVersion: 2 m_Radius: 0.5 @@ -23496,6 +23496,16 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 6865737300552731159} m_Modifications: + - target: {fileID: 302957159522640772, guid: 91b685a7f0a6f7643b8ae61842f883de, + type: 3} + propertyPath: m_CastShadows + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 302957159522640772, guid: 91b685a7f0a6f7643b8ae61842f883de, + type: 3} + propertyPath: m_ReceiveShadows + value: 0 + objectReference: {fileID: 0} - target: {fileID: 5698306997877693391, guid: 91b685a7f0a6f7643b8ae61842f883de, type: 3} propertyPath: m_LocalPosition.x diff --git a/Assets/Zion/Scripts/Adam/Components/ShellBoom.cs b/Assets/Zion/Scripts/Adam/Components/ShellBoom.cs index dba6577d..87c92c9d 100644 --- a/Assets/Zion/Scripts/Adam/Components/ShellBoom.cs +++ b/Assets/Zion/Scripts/Adam/Components/ShellBoom.cs @@ -5,8 +5,9 @@ using UnityEngine.Events; public class ShellBoom : MonoBehaviour { - public UnityEvent onShellAttack; + public UnityEvent onShellAttack = new UnityEvent(); public bool isPlayer = false; + public GameObject attackTarget; private void OnTriggerEnter(Collider other) { if (isPlayer && other.tag == "AttackTarget") @@ -15,4 +16,15 @@ public class ShellBoom : MonoBehaviour } } + private void Update() + { + if (attackTarget != null) + { + Vector3 direction = transform.localPosition - attackTarget.transform.localPosition; + float step = 1 * Time.deltaTime; + transform.rotation = Quaternion.LookRotation(direction); + transform.localPosition = Vector3.MoveTowards(transform.localPosition, attackTarget.transform.localPosition, step); + } + } + } diff --git a/Assets/Zion/Scripts/Adam/DeviceManager.cs b/Assets/Zion/Scripts/Adam/DeviceManager.cs index 892b89f0..4f231047 100644 --- a/Assets/Zion/Scripts/Adam/DeviceManager.cs +++ b/Assets/Zion/Scripts/Adam/DeviceManager.cs @@ -123,17 +123,14 @@ public class DeviceManager : MonoSingleton List temp = GetGXWRJAndZSWRJ(); for (int i = 0; i < temp.Count; i++) { - for (int j = 0; j < temp[i].unmannedAerialVehicles.Count; j++) - { - - if (temp[i].unmannedAerialVehicles[j] != null && temp[i].unmannedAerialVehicles[j].gameObject.activeSelf) + if (temp[i].unmannedAerialVehicles[0] != null && temp[i].unmannedAerialVehicles[0].gameObject.activeSelf) { - if (temp[i].unmannedAerialVehicles[j].attackTarget == null) + if (temp[i].unmannedAerialVehicles[0].attackTarget == null) { - temp[i].unmannedAerialVehicles[j].AttAck(attackColliders[i].transform); + temp[i].unmannedAerialVehicles[0].AttAck(attackColliders[i].transform); } } - } + } } } diff --git a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs index 6921ad24..d82b974a 100644 --- a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs +++ b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicle.cs @@ -232,22 +232,20 @@ public class UnmannedAerialVehicle : MonoBehaviour { while (attackTarget) { - yield return new WaitForSeconds(1f); - GameObject obj = Instantiate(shell); + yield return new WaitForSeconds(0.5f); + GameObject obj = Instantiate(shell, transform); obj.SetActive(true); - ShellBoom sb = obj.AddComponent(); + obj.AddComponent(); + ShellBoom sb = obj.GetComponent(); sb.isPlayer = unmannedAerialVehicleManage.equipmentCommon.isPlayer; + sb.attackTarget = attackTarget.gameObject; sb.onShellAttack.AddListener(() => { AddBao(attackTarget.transform); // 销毁objectToDestroy对象 BeAssaulted("攻击到目标"); + Destroy(sb); }); - Vector3 direction = obj.transform.position - attackTarget.position; - float step = 1 * Time.deltaTime; - obj.transform.rotation = Quaternion.LookRotation(direction); - obj.transform.position = Vector3.MoveTowards(obj.transform.position, attackTarget.position, step); - } }