无人机销毁

This commit is contained in:
账号名 2023-11-23 19:54:42 +08:00
parent c6d15e3e9a
commit 8f4ae32685
2 changed files with 21 additions and 4 deletions

View File

@ -49,15 +49,27 @@ public class DeviceManager : MonoSingleton<DeviceManager>
{
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;
}
}

View File

@ -198,7 +198,12 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
{
if (isEngagedTarget) return;
List<Collider> colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体
List<Collider> colliders1 = colliders.FindAll(x => x.transform.tag == "AttackTarget");
List<Collider> colliders1 = new List<Collider>();
for (int i=0;i< colliders.Count; i++)
{
if (colliders[i].transform.tag == "AttackTarget")
colliders1.Add(colliders[i]);
}
if (colliders1.Count > 0)
{
isEngagedTarget = true;