This commit is contained in:
parent
4ff4d87b90
commit
ff95a85b05
|
@ -71,7 +71,7 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
|||
/// </summary>
|
||||
public GameObject explodePrefab;
|
||||
|
||||
|
||||
public Transform attackTarget;
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (unmannedAerialVehicleManage.equipmentCommon.isPlayer && other.tag == "AttackTarget")
|
||||
|
@ -170,7 +170,8 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
|||
WWWForm wWWForm = new WWWForm();
|
||||
wWWForm.AddField("data", uploadLogMainJson);
|
||||
Debug.Log(uploadLogMainJson);
|
||||
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data => {
|
||||
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data =>
|
||||
{
|
||||
Debug.Log(data);
|
||||
}));
|
||||
}
|
||||
|
@ -192,9 +193,10 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
|||
|
||||
WWWForm headers = new WWWForm();
|
||||
headers.AddField("id", _equipmentCommon.deviceID);
|
||||
//StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data => {
|
||||
// //Debug.Log(data);
|
||||
//}));
|
||||
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data =>
|
||||
{
|
||||
//Debug.Log(data);
|
||||
}));
|
||||
GameObject Bao = Instantiate(explodePrefab, _transform);
|
||||
Bao.transform.localPosition = Vector3.zero;
|
||||
Bao.transform.SetParent(null);
|
||||
|
@ -218,9 +220,12 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
|||
/// </summary>
|
||||
public void AttAck(Transform target)
|
||||
{
|
||||
if (attackTarget == null)
|
||||
{
|
||||
transform.DOKill();
|
||||
attackTarget = target;
|
||||
Debug.Log("开始攻击目标..:" + target.name);
|
||||
Vector3 _v3 = target.position;
|
||||
|
||||
transform.DOLookAt(_v3, 0.1f).OnComplete(() =>
|
||||
{
|
||||
float distance = Vector3.Distance(transform.position, target.position);
|
||||
|
@ -233,6 +238,7 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
|||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发起攻击
|
||||
|
|
|
@ -275,7 +275,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
/// </summary>
|
||||
private void SelectiveAttackDrone()
|
||||
{
|
||||
if (isEngagedTarget) return;
|
||||
//if (isEngagedTarget) return;
|
||||
if (wrjModel == WRJModel.电子侦察无人机 || wrjModel == WRJModel.光学无人机)
|
||||
{
|
||||
List<Collider> colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体
|
||||
|
@ -290,7 +290,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
{
|
||||
if (attackColliders1.Count > 0)
|
||||
{
|
||||
isEngagedTarget = true;
|
||||
//isEngagedTarget = true;
|
||||
//colliders1.ForEach(x => Debug.Log(x.transform.name));
|
||||
int _number = UnityEngine.Random.Range(0, attackColliders1.Count - 1);
|
||||
List<UnmannedAerialVehicle> _unmannedAerialVehicles = unmannedAerialVehicles.FindAll(x => x != null && x.gameObject.activeSelf);
|
||||
|
|
Loading…
Reference in New Issue