diff --git a/Assets/GameAssets/Prefebs/Models/moder/地面无线电干扰.prefab b/Assets/GameAssets/Prefebs/Models/moder/地面无线电干扰.prefab index 39cbeeb4..320fc9be 100644 --- a/Assets/GameAssets/Prefebs/Models/moder/地面无线电干扰.prefab +++ b/Assets/GameAssets/Prefebs/Models/moder/地面无线电干扰.prefab @@ -141,14 +141,14 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5224973007127515503} - m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: -491.42, y: 160.04, z: -89.7} m_LocalScale: {x: 18, y: 18, z: 18} m_Children: - {fileID: 4159137828818466878} m_Father: {fileID: 0} m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &2669641987923470564 MonoBehaviour: m_ObjectHideFlags: 0 @@ -165,6 +165,7 @@ MonoBehaviour: selectedSide: 1 equipmentType: "\u5730\u9762\u65E0\u7EBF\u7535\u5E72\u6270" deviceID: + ISPlayer: 0 explodePrefab: {fileID: 1000013462590818, guid: ecdd96beb7f93494880c052dfccf9dc1, type: 3} isMove: 1 @@ -205,8 +206,8 @@ BoxCollider: m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 - m_Size: {x: 0.42351785, y: 0.4418318, z: 0.49796286} - m_Center: {x: 0.009579976, y: -0.0021133423, z: -0.25554445} + m_Size: {x: 0.42351785, y: 0.5147799, z: 0.42257693} + m_Center: {x: 0.009579976, y: 0.2519765, z: -0.0063182847} --- !u!54 &4108524336644022763 Rigidbody: m_ObjectHideFlags: 0 @@ -234,8 +235,8 @@ BoxCollider: m_IsTrigger: 1 m_Enabled: 1 serializedVersion: 2 - m_Size: {x: 0.42351785, y: 0.4418318, z: 0.49796286} - m_Center: {x: 0.009579976, y: -0.0021133423, z: -0.25554445} + m_Size: {x: 0.42351785, y: 0.5147799, z: 0.41892996} + m_Center: {x: 0.009579976, y: 0.2519765, z: -0.006926146} --- !u!1001 &2003813850601294501 PrefabInstance: m_ObjectHideFlags: 0 @@ -246,22 +247,22 @@ PrefabInstance: - target: {fileID: -8679921383154817045, guid: d14c6397f108bf64b96946deb44c3369, type: 3} propertyPath: m_LocalPosition.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: d14c6397f108bf64b96946deb44c3369, type: 3} propertyPath: m_LocalPosition.y - value: 0 + value: 0.3713 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: d14c6397f108bf64b96946deb44c3369, type: 3} propertyPath: m_LocalPosition.z - value: -0.369 + value: -0.014 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: d14c6397f108bf64b96946deb44c3369, type: 3} propertyPath: m_LocalRotation.x - value: 1 + value: -0.7071068 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: d14c6397f108bf64b96946deb44c3369, type: 3} @@ -276,7 +277,7 @@ PrefabInstance: - target: {fileID: -8679921383154817045, guid: d14c6397f108bf64b96946deb44c3369, type: 3} propertyPath: m_LocalRotation.w - value: 0 + value: 0.7071068 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: d14c6397f108bf64b96946deb44c3369, type: 3} @@ -286,7 +287,7 @@ PrefabInstance: - target: {fileID: -8679921383154817045, guid: d14c6397f108bf64b96946deb44c3369, type: 3} propertyPath: m_LocalEulerAnglesHint.x - value: 180 + value: -90 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: d14c6397f108bf64b96946deb44c3369, type: 3} diff --git a/Assets/Temp/Scripts/Spectrumdetection.cs b/Assets/Temp/Scripts/Spectrumdetection.cs index 650c9743..0b3e964e 100644 --- a/Assets/Temp/Scripts/Spectrumdetection.cs +++ b/Assets/Temp/Scripts/Spectrumdetection.cs @@ -64,6 +64,7 @@ public class Spectrumdetection : MonoBehaviour equipmentCommon = GetComponent(); // 订阅布尔值变化事件 OnActivationChanged += OnActivationChangedHandler; + _isStartRehearsing = GlobalFlag.isStartRehearsing; } /// /// 演习是否启动 diff --git a/Assets/Zion/Scripts/Adam/DeviceManager.cs b/Assets/Zion/Scripts/Adam/DeviceManager.cs index 3a78c52a..9d2017f6 100644 --- a/Assets/Zion/Scripts/Adam/DeviceManager.cs +++ b/Assets/Zion/Scripts/Adam/DeviceManager.cs @@ -31,14 +31,18 @@ public class DeviceManager : MonoSingleton // 布尔值变化时触发的事件 public event System.Action OnActivationChanged; + public void OnInit() + { + // 订阅布尔值变化事件 + OnActivationChanged += OnActivationChangedHandler; + SyncCreateRoom.send2roomRequset += GetSend2roomMsg; + } void Start() { - SyncCreateRoom.send2roomRequset += GetSend2roomMsg; + - // 订阅布尔值变化事件 - OnActivationChanged += OnActivationChangedHandler; } /// @@ -142,9 +146,9 @@ public class DeviceManager : MonoSingleton public List unmannedAerialVehicleManages; public void SetCollider4WRJ(List attackColliders, ref Collider currentTarget) { - for(int i=0; i 0) @@ -156,7 +160,7 @@ public class DeviceManager : MonoSingleton { if (unmannedAerialVehicleManages[i].unmannedAerialVehicles[0].attackTarget == null) { - + unmannedAerialVehicleManages[i].unmannedAerialVehicles[0].AttAck(attackColliders[0].transform); //for (int j = 0; j < attackColliders.Count; j++) //{ @@ -196,10 +200,10 @@ public class DeviceManager : MonoSingleton else if (info[0] == "KeyTarget") { //Debug.Log("接收处理:KeyTarget...:" + data); - HighPriorityTarget highPriorityTarget= HighPriorityTarget.HighPriorityTargets.Find(x => x.Number == info[1]); - if(highPriorityTarget) + HighPriorityTarget highPriorityTarget = HighPriorityTarget.HighPriorityTargets.Find(x => x.Number == info[1]); + if (highPriorityTarget) { - Vector3 Pos=new Vector3(float.Parse(info[3]), float.Parse(info[4]), float.Parse(info[5])); + Vector3 Pos = new Vector3(float.Parse(info[3]), float.Parse(info[4]), float.Parse(info[5])); highPriorityTarget.BeAssaulted(Pos, false, int.Parse(info[2])); } } diff --git a/Assets/Zion/Scripts/Adam/GameManager.cs b/Assets/Zion/Scripts/Adam/GameManager.cs index 2a51e677..47c088b7 100644 --- a/Assets/Zion/Scripts/Adam/GameManager.cs +++ b/Assets/Zion/Scripts/Adam/GameManager.cs @@ -157,6 +157,7 @@ public class GameManager : MonoSingleton tenkokuModule.mainCamera = spt.transform; AddPlayers(spt); + DeviceManager.Instance.OnInit(); DeviceManager.Instance.isStartRehearsing = GlobalFlag.isStartRehearsing; } diff --git a/Assets/Zion/Scripts/ModelFunction/EquipmentCommon.cs b/Assets/Zion/Scripts/ModelFunction/EquipmentCommon.cs index 8c4c953b..f2a1bbb5 100644 --- a/Assets/Zion/Scripts/ModelFunction/EquipmentCommon.cs +++ b/Assets/Zion/Scripts/ModelFunction/EquipmentCommon.cs @@ -76,6 +76,12 @@ public class EquipmentCommon : MonoBehaviour // OnActivationIsPlayer += OnActivationChangedIsPlayer; } + void Start() + { + _isStartRehearsing= GlobalFlag.isStartRehearsing; + } + + void OnActivationChangedIsPlayer(bool newValue) { if (newValue && equipmentType == "蜂群无人机") diff --git a/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs b/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs index d2a78ed2..ddc92f04 100644 --- a/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs +++ b/Assets/Zion/Scripts/ModelFunction/TerrestrialRadioInterference/TerrestrialRadioInterferenceManger.cs @@ -10,7 +10,17 @@ using System; using UnityEngine.UI; using UnityEngine.EventSystems; using Random = UnityEngine.Random; +using static UnityEngine.GraphicsBuffer; +/* +地面无线电干扰对无人机的干扰通常是指对其数据链通信频点的干扰,而不是卫星定位频点的干扰。 + +无人机通常通过数据链与地面控制站进行通信,用于传输指令、图像、视频等数据。这些数据链通信频点通常在特定频段内使用,例如2.4GHz或5.8GHz等。地面无线电干扰可能会在这些频点上发射无关信号,导致无人机与地面控制站之间的通信受到干扰。 + +卫星定位频点(如GPS)通常用于无人机的导航和定位。地面无线电干扰通常不会直接干扰到这些卫星定位频点,因为这些频点由卫星系统控制并具有较高的抗干扰能力。然而,如果地面无线电干扰源的信号干扰范围广泛,可能会产生杂散信号,从而影响无人机的GPS接收机的性能。 + +需要注意的是,针对无人机的干扰行为是非法且危险的,违反了无人机的安全运行规定。在使用无人机或遇到无人机干扰时,应当及时报告相关部门并采取相应的措施。 +*/ /// /// 地面无线电干扰控制 /// @@ -93,13 +103,15 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour /// 地面的图层 /// public LayerMask ground; - + void Awake() + { + // 订阅布尔值变化事件 + OnActivationChanged += OnActivationChangedHandler; + } void Start() { equipmentCommon = GetComponent(); - // 订阅布尔值变化事件 - OnActivationChanged += OnActivationChangedHandler; - + _isStartRehearsing = GlobalFlag.isStartRehearsing; } // Update is called once per frame @@ -150,7 +162,7 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour /// 导条变化调用 /// /// - void OnActivationChangedHandler(bool newValue) + public void OnActivationChangedHandler(bool newValue) { if (newValue) { @@ -301,17 +313,13 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour /// public void Interferencemode(Transform wrj) { - //Collider[] colliders = Physics.OverlapSphere(transform.position, detectionRadius * 100);//检索范围 - //UnmannedAerialVehicle unmannedAerialVehicle = null; UnmannedAerialVehicleManage unmannedAerialVehicleManage = null; - //if (wrj.GetComponent()) - //{ - // unmannedAerialVehicle = wrj.GetComponent(); - //} if (wrj.GetComponent()) { unmannedAerialVehicleManage = wrj.GetComponent(); - unmannedAerialVehicleManage.CheckSatellitePositioningFrequency(this.transform, InterferenceMode, TransmittedPower, InterferingFrequency, InterferenceAngle, ground); + unmannedAerialVehicleManage.CheckSatellitePositioningFrequency( + InterferenceMode, + ground); } isDo = true; } @@ -335,11 +343,18 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour { //Debug.Log(col.name+"数据链通信频点...:" + unmannedAerialVehicle.dataLinkCommunicationFrequency); if (unmannedAerialVehicleManage.dataLinkCommunicationFrequency == "" || InterferingFrequency == "") continue;//无数据不执行 - if (unmannedAerialVehicleManage.dataLinkCommunicationFrequency == InterferingFrequency) + //if (unmannedAerialVehicleManage.dataLinkCommunicationFrequency == InterferingFrequency) + if (unmannedAerialVehicleManage.satellitePositioningFrequency == InterferingFrequency) { Debug.Log("干扰...:" + colliders[i].name + "成功。"); //unmannedAerialVehicle.BeAssaulted("无线电干扰"); - WRJs.Enqueue(unmannedAerialVehicleManage.transform); + Vector3 one = unmannedAerialVehicleManage.transform.position - transform.position; + float angue = Vector3.Angle(one, transform.forward); + if (float.Parse(InterferenceAngle) >= angue) + { + WRJs.Enqueue(unmannedAerialVehicleManage.transform); + } + } } @@ -347,11 +362,17 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour { //Debug.Log(col.name+"数据链通信频点...:" + unmannedAerialVehicle.dataLinkCommunicationFrequency); if (unmannedAerialVehicle.dataLinkCommunicationFrequency == "" || InterferingFrequency == "") continue;//无数据不执行 - if (unmannedAerialVehicle.dataLinkCommunicationFrequency == InterferingFrequency) + //if (unmannedAerialVehicle.dataLinkCommunicationFrequency == InterferingFrequency) + if (unmannedAerialVehicle.satellitePositioningFrequency == InterferingFrequency) { Debug.Log("干扰...:" + colliders[i].name + "成功。"); //unmannedAerialVehicle.BeAssaulted("无线电干扰"); - WRJs.Enqueue(unmannedAerialVehicle.transform); + Vector3 one = unmannedAerialVehicle.transform.position - transform.position; + float angue = Vector3.Angle(one, transform.forward); + if (float.Parse(InterferenceAngle) >= angue) + { + WRJs.Enqueue(unmannedAerialVehicle.transform); + } } } diff --git a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs index 600eb751..9280049e 100644 --- a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs +++ b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs @@ -537,46 +537,34 @@ public class UnmannedAerialVehicleManage : MonoBehaviour /// /// 检测无线电频率 /// - /// 无线电数据 - /// 驱离或者迫降 - public void CheckSatellitePositioningFrequency(Transform target, string interferenceMode, string transmittedPower, string interferingFrequency, string interferenceAngle, LayerMask ground) + /// 无线电 + /// 干扰模式 + /// 发射功率 + /// 干扰频率 + /// 干扰角度 + /// 地面的图层 + public void CheckSatellitePositioningFrequency( + string interferenceMode, + LayerMask ground) { - if (transmittedPower == "10~30W" || transmittedPower == "30~50W") + + if (interferenceMode == "驱离") { - 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); - } - } - } - } + transform.DOKill(); + transform.LookAt(new Vector3(-500, 160, 1600)); + transform.DOMove(new Vector3(-500, 160, 1600), 60); } - if (transmittedPower == "50~100W") + else if (interferenceMode == "迫降") { - if (dataLinkCommunicationFrequency == interferingFrequency) + transform.DOKill(); + RaycastHit hit; + if (Physics.Raycast(transform.position, Vector3.down, out hit, Mathf.Infinity, ground)) { - Vector3 one = transform.position - target.transform.position; - float angue = Vector3.Angle(one, target.transform.forward); - if (float.Parse(interferenceAngle) >= angue) + if (hit.distance > 1f) { - maximumFlyingSpeed = (float.Parse(maximumFlyingSpeed) - 5).ToString(); + hit.point = new Vector3(hit.point.x, hit.point.y + 3, hit.point.z); + transform.DOMove(hit.point, 6); } - } } }