diff --git a/Assets/Zion/Scripts/Adam/Components/ElectronicReconnaissanceDrone.cs b/Assets/Zion/Scripts/Adam/Components/ElectronicReconnaissanceDrone.cs
new file mode 100644
index 00000000..1fd5fd96
--- /dev/null
+++ b/Assets/Zion/Scripts/Adam/Components/ElectronicReconnaissanceDrone.cs
@@ -0,0 +1,20 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+///
+/// 电子侦察无人机
+///
+public class ElectronicReconnaissanceDrone : UAVBase
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Zion/Scripts/Adam/Components/ElectronicReconnaissanceDrone.cs.meta b/Assets/Zion/Scripts/Adam/Components/ElectronicReconnaissanceDrone.cs.meta
new file mode 100644
index 00000000..e749e8f8
--- /dev/null
+++ b/Assets/Zion/Scripts/Adam/Components/ElectronicReconnaissanceDrone.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ddc1db5913d56ec47ac93953631c9a82
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Zion/Scripts/Adam/Components/UAVBase.cs b/Assets/Zion/Scripts/Adam/Components/UAVBase.cs
new file mode 100644
index 00000000..03084082
--- /dev/null
+++ b/Assets/Zion/Scripts/Adam/Components/UAVBase.cs
@@ -0,0 +1,27 @@
+using PData;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+///
+/// 无人机基类
+///
+public class UAVBase : MonoBehaviour
+{
+ public void GetWeatherAttachUAV()
+ {
+
+ }
+ public void SetWeatherValue()
+ {
+ SenceInfo currentSceneInfo = new SenceInfo();
+ currentSceneInfo = UIBootstrap.Instance.currentSceneInfo.data;
+
+ //tenkokuModule.weather_RainAmt = Mathf.Lerp(0f, 1f, float.Parse(currentSceneInfo.EnvRain));
+ //tenkokuModule.weather_SnowAmt = Mathf.Lerp(0f, 1f, float.Parse(currentSceneInfo.EnvSnow));
+ //tenkokuModule.weather_WindAmt = Mathf.Lerp(0f, 1f, float.Parse(currentSceneInfo.EnvWindSpeed));
+ //tenkokuModule.weather_WindDir = Mathf.Lerp(0f, 360f, float.Parse(currentSceneInfo.EnvWindDir));
+ //tenkokuModule.weather_OvercastAmt = Mathf.Lerp(0f, 1f, 1 - (float.Parse(currentSceneInfo.EnvLight) / 10));
+ //tenkokuModule.weather_humidity = Mathf.Lerp(0f, 1f, 1 - (float.Parse(currentSceneInfo.EnvWu) / 100));
+ }
+}
diff --git a/Assets/Zion/Scripts/Adam/Components/UAVBase.cs.meta b/Assets/Zion/Scripts/Adam/Components/UAVBase.cs.meta
new file mode 100644
index 00000000..91a4131e
--- /dev/null
+++ b/Assets/Zion/Scripts/Adam/Components/UAVBase.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1acac6355624a274ea601506c5f2a3ff
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Zion/Scripts/Adam/GameManager.cs b/Assets/Zion/Scripts/Adam/GameManager.cs
index a07ca385..58d555b0 100644
--- a/Assets/Zion/Scripts/Adam/GameManager.cs
+++ b/Assets/Zion/Scripts/Adam/GameManager.cs
@@ -1,5 +1,6 @@
using AdamSync;
using AdamThinkDevicesData;
+using PData;
using RDate;
using System;
using System.Collections;
@@ -419,14 +420,14 @@ public class GameManager : MonoSingleton
public void SetWeatherValue()
{
- tenkokuModule.weather_RainAmt = Mathf.Lerp(0f, 1f, float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvRain));
- tenkokuModule.weather_SnowAmt = Mathf.Lerp(0f, 1f, float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvSnow));
- tenkokuModule.weather_WindAmt = Mathf.Lerp(0f, 1f, float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvWindSpeed));
- tenkokuModule.weather_WindDir = Mathf.Lerp(0f, 360f, float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvWindDir));
- tenkokuModule.weather_OvercastAmt = Mathf.Lerp(0f, 1f, 1 - (float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvLight) / 10));
- tenkokuModule.weather_humidity = Mathf.Lerp(0f, 1f, 1 - (float.Parse(UIBootstrap.Instance.currentSceneInfo.data.EnvWu) / 100));
- Debug.LogError(tenkokuModule.weather_humidity);
- Debug.LogError(tenkokuModule.weather_OvercastAmt);
+ SenceInfo currentSceneInfo = new SenceInfo();
+ currentSceneInfo = UIBootstrap.Instance.currentSceneInfo.data;
+ tenkokuModule.weather_RainAmt = Mathf.Lerp(0f, 1f, float.Parse(currentSceneInfo.EnvRain));
+ tenkokuModule.weather_SnowAmt = Mathf.Lerp(0f, 1f, float.Parse(currentSceneInfo.EnvSnow));
+ tenkokuModule.weather_WindAmt = Mathf.Lerp(0f, 1f, float.Parse(currentSceneInfo.EnvWindSpeed));
+ tenkokuModule.weather_WindDir = Mathf.Lerp(0f, 360f, float.Parse(currentSceneInfo.EnvWindDir));
+ tenkokuModule.weather_OvercastAmt = Mathf.Lerp(0f, 1f, 1 - (float.Parse(currentSceneInfo.EnvLight) / 10));
+ tenkokuModule.weather_humidity = Mathf.Lerp(0f, 1f, 1 - (float.Parse(currentSceneInfo.EnvWu) / 100));
}
diff --git a/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs b/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs
index 26e9e95a..121fbb8a 100644
--- a/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs
+++ b/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs
@@ -150,7 +150,7 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
}
}
-
+
#region 启动暂停
///
/// 导条变化调用
@@ -305,91 +305,13 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
{
if (colliders[i].transform.tag == "WRJ")
{
- UnmannedAerialVehicle unmannedAerialVehicle = null;
- if (colliders[i].GetComponent())
- {
- unmannedAerialVehicle = colliders[i].GetComponent();
- }
UnmannedAerialVehicleManage unmannedAerialVehicleManage = null;
if (colliders[i].GetComponent())
{
unmannedAerialVehicleManage = colliders[i].GetComponent();
}
- if (TransmittedPower == "10~30W" || TransmittedPower == "30~50W" && unmannedAerialVehicleManage != null)
- {
- Debug.LogError("发射功率进来了1");
- Debug.LogError(unmannedAerialVehicleManage.satellitePositioningFrequency);
- Debug.LogError(InterferingFrequency);
- if (unmannedAerialVehicleManage.satellitePositioningFrequency == InterferingFrequency && unmannedAerialVehicleManage != null)
- {
- Debug.LogError("相同频率进来了1");
- Debug.LogError(InterferenceMode);
- Debug.LogError(unmannedAerialVehicleManage != null);
-
- if (InterferenceMode == "驱离" && unmannedAerialVehicleManage != null)
- {
- Debug.LogError("驱离");
-
- unmannedAerialVehicleManage.transform.DOKill();
- unmannedAerialVehicleManage.transform.LookAt(new Vector3(-500, 160, 1600));
- unmannedAerialVehicleManage.transform.DOMove(new Vector3(-500, 160, 1600), 60);
-
- }
- else if (InterferenceMode == "迫降" && unmannedAerialVehicleManage != null)
- {
- Debug.LogError("迫降");
- unmannedAerialVehicleManage.transform.DOKill();
- //unmannedAerialVehicle.transform.DOKill();
- //Debug.LogError(unmannedAerialVehicle.name);
- RaycastHit hit;
- if (Physics.Raycast(unmannedAerialVehicleManage.transform.position, Vector3.down, out hit, Mathf.Infinity, ground))
- {
- if (hit.distance > 1f)
- {
- Debug.LogError(hit.distance);
-
- hit.point = new Vector3(hit.point.x, hit.point.y + 3, hit.point.z);
-
- unmannedAerialVehicleManage.transform.DOMove(hit.point, 6);
-
- }
- else
- {
- speed = 0;
- }
- }
- }
-
- }
- }
- if (TransmittedPower == "50~100W" && unmannedAerialVehicleManage != null)
- {
- Debug.LogError("功率进来了2");
- if (unmannedAerialVehicleManage.dataLinkCommunicationFrequency == InterferingFrequency && unmannedAerialVehicleManage != null)
- {
- Debug.LogError("频率进来了");
- if (unmannedAerialVehicleManage != null)
- {
- Vector3 one = unmannedAerialVehicleManage.transform.position - transform.position;
- float angue = Vector3.Angle(one, transform.forward);
- if (float.Parse(InterferenceAngle) >= angue)
- {
- //unmannedAerialVehicleManage.transform.DOKill();
- Debug.LogError("目标出现在范围内");
- Debug.LogError(unmannedAerialVehicleManage.maximumFlyingSpeed);
- unmannedAerialVehicleManage.maximumFlyingSpeed = (float.Parse(unmannedAerialVehicleManage.maximumFlyingSpeed) - 5).ToString();
- Debug.LogError(unmannedAerialVehicleManage.maximumFlyingSpeed);
- }
- else
- {
-
- Debug.LogError("目标没有出现在范围里面");
-
-
- }
- }
- }
- }
+ if (unmannedAerialVehicleManage != null)
+ unmannedAerialVehicleManage.CheckSatellitePositioningFrequency(this.transform, InterferenceMode, TransmittedPower, InterferingFrequency, InterferenceAngle, ground);
}
}
}
@@ -399,7 +321,7 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
///
private void Angularrange()
{
- Collider[] collider = Physics.OverlapSphere(transform.position,300);
+ Collider[] collider = Physics.OverlapSphere(transform.position, 300);
for (int i = 0; i < collider.Length; i++)
{
if (collider[i].transform.tag == "WRJ")
diff --git a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs
index 2ab43d6a..cc5973db 100644
--- a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs
+++ b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs
@@ -8,6 +8,8 @@ using AdamSync;
using System.Linq;
using static InterfaceManager;
using Newtonsoft.Json;
+using PData;
+
public enum WRJModel
{
无人机,
@@ -98,6 +100,11 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
///
public bool isEngagedTarget = false;
+ ///
+ /// 光学无人机
+ ///
+ public Camera gxWRJCamera;
+
#region 无人机数据
///
/// 续航时间
@@ -178,7 +185,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
break;
}
-
+
}
var _unmannedAerialVehicle = unmannedAerialVehicles.FindAll(x => x != null && x.gameObject.activeSelf);
@@ -246,6 +253,22 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
}
+ public void SwitchWRJModel()
+ {
+ gxWRJCamera.gameObject.SetActive(false);
+ switch (wrjModel)
+ {
+ case WRJModel.光学无人机:
+ gxWRJCamera.gameObject.SetActive(true);
+ break;
+ case WRJModel.电子侦察无人机:
+ break;
+ case WRJModel.自杀式无人机:
+ break;
+ }
+ }
+
+
///
/// 攻击打击
///
@@ -264,7 +287,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
isEngagedTarget = true;
colliders1.ForEach(x => Debug.Log(x.transform.name));
int _number = UnityEngine.Random.Range(0, colliders1.Count - 1);
- List _unmannedAerialVehicles = unmannedAerialVehicles.FindAll(x => x != null&&x.gameObject.activeSelf);
+ List _unmannedAerialVehicles = unmannedAerialVehicles.FindAll(x => x != null && x.gameObject.activeSelf);
SendMsg(colliders1[_number].transform);
for (int i = 0; i < _unmannedAerialVehicles.Count; i++)
{
@@ -325,6 +348,9 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
// Debug.Log(msg);
// _ = SyncCreateRoom.SendMessageAsync(msg);
//}
+ SenceInfo currentSceneInfo = new SenceInfo();
+ currentSceneInfo = UIBootstrap.Instance.currentSceneInfo.data;
+ //int windSpeed = Mathf.Lerp(0f, 1f, float.Parse(currentSceneInfo.EnvWindSpeed));
for (int i = 0; i < weaponitemone.Count; i++)
{
switch (weaponitemone[i].para_name)
@@ -337,7 +363,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
break;
case "最大飞行速度:":
maximumFlyingSpeed = weaponitemone[i].para_value;
- FireSpeed = float.Parse(maximumFlyingSpeed);
+
break;
case "RCS:":
RCS = weaponitemone[i].para_value;
@@ -422,12 +448,107 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
default:
break;
}
+
+ ///根据风得速度改变无人机得速度
+ FireSpeed = float.Parse(maximumFlyingSpeed) / int.Parse(currentSceneInfo.EnvWindSpeed);
+ ///如果风速大于6级,无人机停止飞行
+ if (int.Parse(currentSceneInfo.EnvWindSpeed) > 6)
+ {
+ FireSpeed = 0;
+ }
+ CheckRSC();
if (i == (weaponitemone.Count - 1))
{
StartCoroutine(WeaponitemoneDataAddition());
}
}
}
+ ///
+ /// 雷达检测无人机身上得RSC
+ ///
+ public void CheckRSC()
+ {
+ float rcs = float.Parse(RCS);
+ if (rcs <= 0.5 && rcs >= 0.1)
+ {
+ StartCoroutine(ShowRadarTips(0.8f, 2));
+ }
+ else if (rcs >= 0.5f && rcs <= 1)
+ {
+ StartCoroutine(ShowRadarTips(0.4f, 1));
+ }
+ }
+ ///
+ /// 多少时间在对方雷达界面上显示红色标记
+ ///
+ ///
+ ///
+ ///
+ private IEnumerator ShowRadarTips(float minTime, float maxTime)
+ {
+ GameObject tips = transform.Find("Minimapwrj").gameObject;
+ while (true)
+ {
+ tips.gameObject.SetActive(false);
+ float time = UnityEngine.Random.Range(minTime, maxTime);
+ yield return new WaitForSeconds(time);
+ tips.gameObject.SetActive(true);
+ }
+ }
+
+ ///
+ /// 检测无线电频率
+ ///
+ /// 无线电数据
+ /// 驱离或者迫降
+ public void CheckSatellitePositioningFrequency(Transform target, string interferenceMode, string transmittedPower, string interferingFrequency, string interferenceAngle, LayerMask ground)
+ {
+ if (transmittedPower == "10~30W" || transmittedPower == "30~50W")
+ {
+ if (satellitePositioningFrequency == interferingFrequency)
+ {
+ if (interferenceMode == "驱离")
+ {
+ transform.DOKill();
+ transform.LookAt(new Vector3(-500, 160, 1600));
+ transform.DOMove(new Vector3(-500, 160, 1600), 60);
+
+ }
+ else if (interferenceMode == "迫降")
+ {
+ transform.DOKill();
+ RaycastHit hit;
+ if (Physics.Raycast(transform.position, Vector3.down, out hit, Mathf.Infinity, ground))
+ {
+ if (hit.distance > 1f)
+ {
+ hit.point = new Vector3(hit.point.x, hit.point.y + 3, hit.point.z);
+ transform.DOMove(hit.point, 6);
+
+ }
+ }
+ }
+
+ }
+ }
+ if (transmittedPower == "50~100W")
+ {
+ if (dataLinkCommunicationFrequency == interferingFrequency)
+ {
+ Vector3 one = transform.position - target.transform.position;
+ float angue = Vector3.Angle(one, target.transform.forward);
+ if (float.Parse(interferenceAngle) >= angue)
+ {
+ maximumFlyingSpeed = (float.Parse(maximumFlyingSpeed) - 5).ToString();
+ }
+
+ }
+ }
+ }
+
+
+
+
///
/// 单个无人机数据写入
@@ -455,6 +576,9 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
}
#endregion
+
+
+
#region 阵型编队
///
/// 阵型选择
@@ -694,6 +818,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
}
private void OnDestroy()
{
+ StopAllCoroutines();
Destroy(airRoute.gameObject);
OnActivationChanged -= OnActivationChangedHandler;
}