From 8f4ae3268544b69b5063845f6a38cba244cd549d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=90=8D?= <3077614386@qq.com> Date: Thu, 23 Nov 2023 19:54:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E4=BA=BA=E6=9C=BA=E9=94=80=E6=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Zion/Scripts/Adam/DeviceManager.cs | 18 +++++++++++++++--- .../UAV/UnmannedAerialVehicleManage.cs | 7 ++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Assets/Zion/Scripts/Adam/DeviceManager.cs b/Assets/Zion/Scripts/Adam/DeviceManager.cs index 7453c85b..5b1e4357 100644 --- a/Assets/Zion/Scripts/Adam/DeviceManager.cs +++ b/Assets/Zion/Scripts/Adam/DeviceManager.cs @@ -49,15 +49,27 @@ public class DeviceManager : MonoSingleton { devices.ForEach(x => x.isStartRehearsing = newValue); } - - + + public bool isOnlyOne = true; private void Update() { - if (send2roomStr.Count > 0) + if (send2roomStr.Count > 0&&isOnlyOne) + { + isOnlyOne = false; + StartCoroutine(DequeueSend2roomStr()); + } + } + + IEnumerator DequeueSend2roomStr() + { + while (send2roomStr.Count > 0) { _ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", send2roomStr.Dequeue())); + yield return new WaitForSeconds(0.035f); + if(send2roomStr.Count==0) + isOnlyOne = true; } } diff --git a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs index b79d0811..eb9a0f9c 100644 --- a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs +++ b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs @@ -198,7 +198,12 @@ public class UnmannedAerialVehicleManage : MonoBehaviour { if (isEngagedTarget) return; List colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体 - List colliders1 = colliders.FindAll(x => x.transform.tag == "AttackTarget"); + List colliders1 = new List(); + for (int i=0;i< colliders.Count; i++) + { + if (colliders[i].transform.tag == "AttackTarget") + colliders1.Add(colliders[i]); + } if (colliders1.Count > 0) { isEngagedTarget = true;