无人机销毁
This commit is contained in:
parent
c6d15e3e9a
commit
8f4ae32685
|
@ -49,15 +49,27 @@ public class DeviceManager : MonoSingleton<DeviceManager>
|
||||||
{
|
{
|
||||||
devices.ForEach(x => x.isStartRehearsing = newValue);
|
devices.ForEach(x => x.isStartRehearsing = newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public bool isOnlyOne = true;
|
||||||
private void Update()
|
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()));
|
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", send2roomStr.Dequeue()));
|
||||||
|
yield return new WaitForSeconds(0.035f);
|
||||||
|
if(send2roomStr.Count==0)
|
||||||
|
isOnlyOne = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,12 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
{
|
{
|
||||||
if (isEngagedTarget) return;
|
if (isEngagedTarget) return;
|
||||||
List<Collider> colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体
|
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)
|
if (colliders1.Count > 0)
|
||||||
{
|
{
|
||||||
isEngagedTarget = true;
|
isEngagedTarget = true;
|
||||||
|
|
Loading…
Reference in New Issue