无线电
This commit is contained in:
parent
3ab059e9b2
commit
15286af0bf
|
@ -78,10 +78,9 @@ MonoBehaviour:
|
||||||
explodePrefab: {fileID: 1000013462590818, guid: ecdd96beb7f93494880c052dfccf9dc1,
|
explodePrefab: {fileID: 1000013462590818, guid: ecdd96beb7f93494880c052dfccf9dc1,
|
||||||
type: 3}
|
type: 3}
|
||||||
speed: 50
|
speed: 50
|
||||||
transformpanl: {fileID: 0}
|
|
||||||
ground:
|
ground:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 1
|
m_Bits: 256
|
||||||
--- !u!65 &7099352370737318148
|
--- !u!65 &7099352370737318148
|
||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -6,6 +6,7 @@ using AdamSync;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using static InterfaceManager;
|
using static InterfaceManager;
|
||||||
|
using System;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 地面无线电干扰控制
|
/// 地面无线电干扰控制
|
||||||
|
@ -15,6 +16,7 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
||||||
|
|
||||||
public EquipmentCommon equipmentCommon;
|
public EquipmentCommon equipmentCommon;
|
||||||
|
|
||||||
|
|
||||||
#region 地面无线电干扰数据
|
#region 地面无线电干扰数据
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 干扰频率
|
/// 干扰频率
|
||||||
|
@ -83,7 +85,7 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 飞机迫降的速度
|
/// 飞机迫降的速度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float speed = 30;
|
public float speed = 80;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 地面的图层
|
/// 地面的图层
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -109,6 +111,8 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
||||||
AddBao(unmannedAerialVehicle);
|
AddBao(unmannedAerialVehicle);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Interferencemode();
|
||||||
|
Angularrange();
|
||||||
}
|
}
|
||||||
#region 启动暂停
|
#region 启动暂停
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -133,7 +137,7 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
//Debug.Log("Timer fired at: " + Time.time);
|
//Debug.Log("Timer fired at: " + Time.time);
|
||||||
yield return new WaitForSeconds(3); // 等待一段时间后继续执行
|
yield return new WaitForSeconds(0.5f); // 等待一段时间后继续执行
|
||||||
RadioDisturbance();
|
RadioDisturbance();
|
||||||
//Interferencemode();
|
//Interferencemode();
|
||||||
}
|
}
|
||||||
|
@ -252,26 +256,67 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 干扰模式
|
/// 干扰模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Interferencemode()
|
public void Interferencemode()
|
||||||
{
|
{
|
||||||
Collider[] colliders = Physics.OverlapSphere(transform.position, 100);//检索范围
|
Collider[] colliders = Physics.OverlapSphere(transform.position, 300);//检索范围
|
||||||
for (int i = 0; i < colliders.Length; i++)
|
for (int i = 0; i < colliders.Length; i++)
|
||||||
{
|
{
|
||||||
if (colliders[i].transform.tag == "WRJ")
|
if (colliders[i].transform.tag == "WRJ")
|
||||||
{
|
{
|
||||||
UnmannedAerialVehicle unmannedAerialVehicle = colliders[i].GetComponent<UnmannedAerialVehicle>();
|
UnmannedAerialVehicle unmannedAerialVehicle = colliders[i].GetComponent<UnmannedAerialVehicle>();
|
||||||
if (InterferenceMode == "驱离" && Vector3.Distance(transform.position, unmannedAerialVehicle.transform.position) < 100)
|
if (InterferenceMode == "驱离")
|
||||||
{
|
{
|
||||||
Debug.LogError(unmannedAerialVehicle.name);
|
Debug.LogError(unmannedAerialVehicle.name);
|
||||||
unmannedAerialVehicle.transform.Translate(Vector3.back * 50 * Time.deltaTime);
|
unmannedAerialVehicle.transform.parent = null;
|
||||||
|
unmannedAerialVehicle.transform.Translate(Vector3.back * speed * Time.deltaTime);
|
||||||
}
|
}
|
||||||
else if (InterferenceMode == "迫降" && Vector3.Distance(transform.position, unmannedAerialVehicle.transform.position) < 100)
|
else if (InterferenceMode == "迫降")
|
||||||
{
|
{
|
||||||
Debug.LogError(unmannedAerialVehicle.name);
|
Debug.LogError(unmannedAerialVehicle.name);
|
||||||
unmannedAerialVehicle.transform.Translate(Vector3.down * 50 * Time.deltaTime);
|
RaycastHit hit;
|
||||||
|
if (Physics.Raycast(unmannedAerialVehicle.transform.position, Vector3.down, out hit, Mathf.Infinity, ground))
|
||||||
|
{
|
||||||
|
if (hit.distance > 0.5f)
|
||||||
|
{
|
||||||
|
Debug.LogError(hit.distance);
|
||||||
|
unmannedAerialVehicle.transform.parent = null;
|
||||||
|
unmannedAerialVehicle.transform.Translate(Vector3.down * speed * Time.deltaTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
speed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 干扰无人机角度范围
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
private void Angularrange()
|
||||||
|
{
|
||||||
|
Collider[] collider = Physics.OverlapSphere(transform.position, 300);
|
||||||
|
for (int i = 0; i < collider.Length; i++)
|
||||||
|
{
|
||||||
|
if (collider[i].transform.tag=="WRJ")
|
||||||
|
{
|
||||||
|
UnmannedAerialVehicle unmannedAerialVehicle = collider[i].GetComponent<UnmannedAerialVehicle>();
|
||||||
|
Vector3 one =unmannedAerialVehicle.transform.position-transform.position;
|
||||||
|
float angue = Vector3.Angle(transform.forward, one);
|
||||||
|
if (float.Parse(InterferenceAngle)>=angue)
|
||||||
|
{
|
||||||
|
Debug.LogError("目标出现在范围内");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("目标没有出现在范围里面");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,27 +344,7 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
||||||
//unmannedAerialVehicle.BeAssaulted("无线电干扰");
|
//unmannedAerialVehicle.BeAssaulted("无线电干扰");
|
||||||
unmannedAerialVehicles.Enqueue(unmannedAerialVehicle);
|
unmannedAerialVehicles.Enqueue(unmannedAerialVehicle);
|
||||||
}
|
}
|
||||||
else if(InterferenceMode == "驱离" && Vector3.Distance(transform.position,unmannedAerialVehicle.transform.position) < 100)
|
|
||||||
{
|
|
||||||
Debug.LogError(unmannedAerialVehicle.name);
|
|
||||||
unmannedAerialVehicle.transform.Translate(Vector3.back * 50 * Time.deltaTime);
|
|
||||||
}
|
|
||||||
else if (InterferenceMode == "迫降" && Vector3.Distance(transform.position,unmannedAerialVehicle.transform.position) < 100)
|
|
||||||
{
|
|
||||||
Debug.LogError(unmannedAerialVehicle.name);
|
|
||||||
RaycastHit hit;
|
|
||||||
if (Physics.Raycast(unmannedAerialVehicle.transform.position,Vector3.down,out hit,Mathf.Infinity,ground))
|
|
||||||
{
|
|
||||||
if (hit.distance>0.5f)
|
|
||||||
{
|
|
||||||
unmannedAerialVehicle.transform.Translate(Vector3.down * speed * Time.deltaTime);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
speed= 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if(isStartRehearsing && equipmentCommon.isPlayer)
|
if (isStartRehearsing && equipmentCommon.isPlayer)
|
||||||
{
|
{
|
||||||
switch (pattern)
|
switch (pattern)
|
||||||
{
|
{
|
||||||
|
@ -164,7 +164,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
var _unmannedAerialVehicle = unmannedAerialVehicles.FindAll(x => x != null);
|
var _unmannedAerialVehicle = unmannedAerialVehicles.FindAll(x => x != null);
|
||||||
if (_unmannedAerialVehicle.Count==0)
|
if (_unmannedAerialVehicle.Count == 0)
|
||||||
{
|
{
|
||||||
string nowData = string.Format("{0},{1}", "SetToBeDestroyed", equipmentCommon.deviceID);
|
string nowData = string.Format("{0},{1}", "SetToBeDestroyed", equipmentCommon.deviceID);
|
||||||
Debug.Log(nowData);
|
Debug.Log(nowData);
|
||||||
|
@ -172,7 +172,8 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
UploadLog(equipmentCommon.deviceID);
|
UploadLog(equipmentCommon.deviceID);
|
||||||
WWWForm headers = new WWWForm();
|
WWWForm headers = new WWWForm();
|
||||||
headers.AddField("id", equipmentCommon.deviceID);
|
headers.AddField("id", equipmentCommon.deviceID);
|
||||||
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data => {
|
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data =>
|
||||||
|
{
|
||||||
Debug.Log(data);
|
Debug.Log(data);
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}));
|
}));
|
||||||
|
@ -200,7 +201,8 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
WWWForm wWWForm = new WWWForm();
|
WWWForm wWWForm = new WWWForm();
|
||||||
wWWForm.AddField("data", uploadLogMainJson);
|
wWWForm.AddField("data", uploadLogMainJson);
|
||||||
Debug.Log(uploadLogMainJson);
|
Debug.Log(uploadLogMainJson);
|
||||||
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data => {
|
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data =>
|
||||||
|
{
|
||||||
Debug.Log(data);
|
Debug.Log(data);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -237,7 +239,7 @@ 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 = new List<Collider>();
|
List<Collider> colliders1 = new List<Collider>();
|
||||||
for (int i=0;i< colliders.Count; i++)
|
for (int i = 0; i < colliders.Count; i++)
|
||||||
{
|
{
|
||||||
if (colliders[i].transform.tag == "AttackTarget")
|
if (colliders[i].transform.tag == "AttackTarget")
|
||||||
colliders1.Add(colliders[i]);
|
colliders1.Add(colliders[i]);
|
||||||
|
@ -326,16 +328,81 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
RCS = weaponitemone[i].para_value;
|
RCS = weaponitemone[i].para_value;
|
||||||
break;
|
break;
|
||||||
case "卫星定位频点:":
|
case "卫星定位频点:":
|
||||||
satellitePositioningFrequency = weaponitemone[i].para_value;
|
//satellitePositioningFrequency = weaponitemone[i].para_value;
|
||||||
|
switch (weaponitemone[i].para_value)
|
||||||
|
{
|
||||||
|
case "0":
|
||||||
|
satellitePositioningFrequency = "1227.60 MHz";
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
satellitePositioningFrequency = "1381.05 MHz";
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
satellitePositioningFrequency = "1575.42 MHz";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "数据链通信频点:":
|
case "数据链通信频点:":
|
||||||
dataLinkCommunicationFrequency = weaponitemone[i].para_value;
|
//dataLinkCommunicationFrequency = weaponitemone[i].para_value;
|
||||||
|
switch (weaponitemone[i].para_value)
|
||||||
|
{
|
||||||
|
case "0":
|
||||||
|
dataLinkCommunicationFrequency = "2GHz";
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
dataLinkCommunicationFrequency = "4GHz";
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
dataLinkCommunicationFrequency = "5GHz";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "电子侦察能力:":
|
case "电子侦察能力:":
|
||||||
electronicReconnaissanceCapability = weaponitemone[i].para_value;
|
//electronicReconnaissanceCapability = weaponitemone[i].para_value;
|
||||||
|
switch (weaponitemone[i].para_value)
|
||||||
|
{
|
||||||
|
case "0":
|
||||||
|
electronicReconnaissanceCapability = "UHF";
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
electronicReconnaissanceCapability = "L";
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
electronicReconnaissanceCapability = "S";
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
electronicReconnaissanceCapability = "C";
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
electronicReconnaissanceCapability = "X";
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
electronicReconnaissanceCapability = "Ku";
|
||||||
|
break;
|
||||||
|
case "6":
|
||||||
|
electronicReconnaissanceCapability = "Ka";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "光学侦察能力:":
|
case "光学侦察能力:":
|
||||||
opticalReconnaissanceCapability = weaponitemone[i].para_value;
|
//opticalReconnaissanceCapability = weaponitemone[i].para_value;
|
||||||
|
switch (weaponitemone[i].para_value)
|
||||||
|
{
|
||||||
|
case "0":
|
||||||
|
opticalReconnaissanceCapability = "有";
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
opticalReconnaissanceCapability = "无";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -546,7 +613,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
yield return new WaitForSeconds(_time); // 等待一帧时间
|
yield return new WaitForSeconds(_time); // 等待一帧时间
|
||||||
isMove = true;
|
isMove = true;
|
||||||
}
|
}
|
||||||
public IEnumerator MoveObjectAlongPath(Vector3 _positions,bool _isMove) // 协程:按路线移动物体
|
public IEnumerator MoveObjectAlongPath(Vector3 _positions, bool _isMove) // 协程:按路线移动物体
|
||||||
{
|
{
|
||||||
Vector3 targetPosition = new Vector3(_positions.x, 200, _positions.z);// 目标位置为当前顶点坐标
|
Vector3 targetPosition = new Vector3(_positions.x, 200, _positions.z);// 目标位置为当前顶点坐标
|
||||||
float _distance = Vector3.Distance(transform.position, targetPosition);
|
float _distance = Vector3.Distance(transform.position, targetPosition);
|
||||||
|
|
|
@ -7,6 +7,7 @@ TagManager:
|
||||||
- Found
|
- Found
|
||||||
- WRJ
|
- WRJ
|
||||||
- AttackTarget
|
- AttackTarget
|
||||||
|
- WRJ1
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
|
Loading…
Reference in New Issue