This commit is contained in:
yulong 2023-12-28 14:01:09 +08:00
parent 07660aa843
commit a68d819522
2 changed files with 22 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using AdamThinkDevicesData;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -107,7 +108,27 @@ public class Spectrumdetection : MonoBehaviour
}
void Update()
{
Search();
}
/// <summary>
/// 搜索范围内的无人机
/// </summary>
private void Search()
{
Collider[] colliders = Physics.OverlapSphere(transform.position, float.Parse(Detectionrange) * 100);
for (int i = 0; i < colliders.Length; i++)
{
if (colliders[i].transform.gameObject.tag=="WRJ")
{
UnmannedAerialVehicleManage unmannedAerialVehicleManage = null;
if (colliders[i].GetComponent<UnmannedAerialVehicleManage>())
{
unmannedAerialVehicleManage = colliders[i].GetComponent<UnmannedAerialVehicleManage>();
}
}
}
}
private void OnDestroy()
{

View File

@ -241,7 +241,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
List<Collider> colliders1 = new List<Collider>();
for (int i = 0; i < colliders.Count; i++)
{
if (colliders[i].transform.tag == "AttackTarget")
if (colliders[i].transform.tag == "AttackTarget" || colliders[i].transform.tag== "AttackTarget1")
colliders1.Add(colliders[i]);
}
if (colliders1.Count > 0)