From 31a35c99a1f1a8f2ba900b043c8d99a877617a36 Mon Sep 17 00:00:00 2001 From: YangHua <1475658476@qq.com> Date: Fri, 19 Jan 2024 14:29:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A0=E4=BA=BA=E6=9C=BA?= =?UTF-8?q?=E5=9E=8B=E5=8F=B7=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TEXTURES/mat_moon.mat | 4 +- .../Prefebs/Models/moder/无人机List.prefab | 156 ++++++++++++++---- Assets/Zion/Scripts/Adam/DeviceManager.cs | 41 +++++ Assets/Zion/Scripts/Adam/GameManager.cs | 2 +- .../UAV/UnmannedAerialVehicleManage.cs | 87 ++++++---- 5 files changed, 217 insertions(+), 73 deletions(-) diff --git a/Assets/3rdParty/TENKOKU - DYNAMIC SKY/TEXTURES/mat_moon.mat b/Assets/3rdParty/TENKOKU - DYNAMIC SKY/TEXTURES/mat_moon.mat index 44f8ade1..846a590c 100644 --- a/Assets/3rdParty/TENKOKU - DYNAMIC SKY/TEXTURES/mat_moon.mat +++ b/Assets/3rdParty/TENKOKU - DYNAMIC SKY/TEXTURES/mat_moon.mat @@ -32,8 +32,8 @@ Material: - _dispStrength: 1 - _overBright: 1 m_Colors: - - _AmbientTint: {r: 0, g: 0, b: 0, a: 1} - - _Color: {r: 0.25, g: 0.25, b: 0.25, a: 0.040000003} + - _AmbientTint: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 0.5, g: 0.49803922, b: 0.49215686, a: 0.2} - _GlowColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} - _PrimaryTint: {r: 1, g: 1, b: 1, a: 1} - _TintColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab b/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab index 26a1bf4a..249c5627 100644 --- a/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab +++ b/Assets/GameAssets/Prefebs/Models/moder/无人机List.prefab @@ -355,6 +355,7 @@ MonoBehaviour: FireSpeed: 20 detectionRadius: 50 isEngagedTarget: 0 + gxWRJCamera: {fileID: 6382256847466738257} batteryLife: 1 classificationWindResistance: 1 maximumFlyingSpeed: 1 @@ -363,6 +364,89 @@ MonoBehaviour: dataLinkCommunicationFrequency: 1 electronicReconnaissanceCapability: 1 opticalReconnaissanceCapability: 1 +--- !u!1 &7326748669528570608 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8245684177115831463} + - component: {fileID: 6382256847466738257} + - component: {fileID: 4942465351206027101} + m_Layer: 11 + m_Name: Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8245684177115831463 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7326748669528570608} + m_LocalRotation: {x: 0.17382409, y: -0, z: -0, w: 0.98477674} + m_LocalPosition: {x: 0, y: 0, z: 0.173} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5512074156260461627} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 20.02, y: 0, z: 0} +--- !u!20 &6382256847466738257 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7326748669528570608} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!81 &4942465351206027101 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7326748669528570608} + m_Enabled: 1 --- !u!1001 &87581316664468991 PrefabInstance: m_ObjectHideFlags: 0 @@ -6449,12 +6533,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 088baeb890d17754287a1161c0b1dceb, type: 3} ---- !u!4 &8539805826321748420 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, - type: 3} - m_PrefabInstance: {fileID: 1752211167157593052} - m_PrefabAsset: {fileID: 0} --- !u!114 &361993472053131937 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 2114182605201611133, guid: 088baeb890d17754287a1161c0b1dceb, @@ -6467,6 +6545,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8d11073938bcdd54589608b4b411b889, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &8539805826321748420 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, + type: 3} + m_PrefabInstance: {fileID: 1752211167157593052} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1770522258813735065 PrefabInstance: m_ObjectHideFlags: 0 @@ -12553,12 +12637,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 088baeb890d17754287a1161c0b1dceb, type: 3} ---- !u!4 &5167349154997552048 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, - type: 3} - m_PrefabInstance: {fileID: 2982643334479475112} - m_PrefabAsset: {fileID: 0} --- !u!114 &3761472913846298837 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 2114182605201611133, guid: 088baeb890d17754287a1161c0b1dceb, @@ -12571,6 +12649,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8d11073938bcdd54589608b4b411b889, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &5167349154997552048 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, + type: 3} + m_PrefabInstance: {fileID: 2982643334479475112} + m_PrefabAsset: {fileID: 0} --- !u!1001 &3048292988923725988 PrefabInstance: m_ObjectHideFlags: 0 @@ -16913,12 +16997,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 088baeb890d17754287a1161c0b1dceb, type: 3} ---- !u!4 &2499279008215596091 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, - type: 3} - m_PrefabInstance: {fileID: 5511666963674910243} - m_PrefabAsset: {fileID: 0} --- !u!114 &5848568455846123358 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 2114182605201611133, guid: 088baeb890d17754287a1161c0b1dceb, @@ -16931,6 +17009,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8d11073938bcdd54589608b4b411b889, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &2499279008215596091 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, + type: 3} + m_PrefabInstance: {fileID: 5511666963674910243} + m_PrefabAsset: {fileID: 0} --- !u!1001 &5521732607769453082 PrefabInstance: m_ObjectHideFlags: 0 @@ -18657,12 +18741,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 088baeb890d17754287a1161c0b1dceb, type: 3} ---- !u!4 &2577865565644119590 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, - type: 3} - m_PrefabInstance: {fileID: 5554079564960066622} - m_PrefabAsset: {fileID: 0} --- !u!114 &5783492806809580867 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 2114182605201611133, guid: 088baeb890d17754287a1161c0b1dceb, @@ -18675,6 +18753,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8d11073938bcdd54589608b4b411b889, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &2577865565644119590 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, + type: 3} + m_PrefabInstance: {fileID: 5554079564960066622} + m_PrefabAsset: {fileID: 0} --- !u!1001 &6233801842401300491 PrefabInstance: m_ObjectHideFlags: 0 @@ -24856,12 +24940,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 088baeb890d17754287a1161c0b1dceb, type: 3} ---- !u!4 &1611324478266105742 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, - type: 3} - m_PrefabInstance: {fileID: 8687151149057306006} - m_PrefabAsset: {fileID: 0} --- !u!114 &7339143432620078315 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 2114182605201611133, guid: 088baeb890d17754287a1161c0b1dceb, @@ -24874,6 +24952,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8d11073938bcdd54589608b4b411b889, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &1611324478266105742 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, + type: 3} + m_PrefabInstance: {fileID: 8687151149057306006} + m_PrefabAsset: {fileID: 0} --- !u!1001 &8867769748213934429 PrefabInstance: m_ObjectHideFlags: 0 @@ -26600,12 +26684,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 088baeb890d17754287a1161c0b1dceb, type: 3} ---- !u!4 &1550832753322196951 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, - type: 3} - m_PrefabInstance: {fileID: 8887797578038627791} - m_PrefabAsset: {fileID: 0} --- !u!114 &7350113383591171250 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 2114182605201611133, guid: 088baeb890d17754287a1161c0b1dceb, @@ -26618,3 +26696,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8d11073938bcdd54589608b4b411b889, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &1550832753322196951 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7985558213978141208, guid: 088baeb890d17754287a1161c0b1dceb, + type: 3} + m_PrefabInstance: {fileID: 8887797578038627791} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Zion/Scripts/Adam/DeviceManager.cs b/Assets/Zion/Scripts/Adam/DeviceManager.cs index 4c05c095..fd597318 100644 --- a/Assets/Zion/Scripts/Adam/DeviceManager.cs +++ b/Assets/Zion/Scripts/Adam/DeviceManager.cs @@ -80,6 +80,47 @@ public class DeviceManager : MonoSingleton devices.Add(d); } } + /// + /// 获取光学无人机和自杀式无人机 + /// + /// + public List GetGXWRJAndZSWRJ() + { + List tempUAM = new List(); + for (int i = 0; i < devices.Count; i++) + { + if (devices[i] != null && devices[i].gameObject.name.Contains("无人机")) + { + UnmannedAerialVehicleManage temp = devices[i].GetComponent(); + if (temp != null) + { + if (temp.wrjModel == WRJModel.光学无人机 || temp.wrjModel == WRJModel.自杀式无人机) + tempUAM.Add(temp); + } + } + } + return tempUAM; + } + + public void SetCollider4WRJ(List attackColliders) + { + int _number = Random.Range(0, attackColliders.Count - 1); + if (attackColliders.Count > 0) + { + List temp = GetGXWRJAndZSWRJ(); + for (int i = 0; i < temp.Count; i++) + { + for (int j = 0; j < temp[i].unmannedAerialVehicles.Count; j++) + { + + if(temp[i].unmannedAerialVehicles[j] != null && temp[i].unmannedAerialVehicles[j].gameObject.activeSelf) + { + temp[i].unmannedAerialVehicles[j].AttAck(attackColliders[_number].transform); + } + } + } + } + } public void GetSend2roomMsg(string data) { diff --git a/Assets/Zion/Scripts/Adam/GameManager.cs b/Assets/Zion/Scripts/Adam/GameManager.cs index 3c9e413a..ba093039 100644 --- a/Assets/Zion/Scripts/Adam/GameManager.cs +++ b/Assets/Zion/Scripts/Adam/GameManager.cs @@ -380,7 +380,7 @@ public class GameManager : MonoSingleton device.GetComponent().deviceID = data.id; device.GetComponent().FillInTheData(data.list_para); - Debug.Log($"{data.r3 == GlobalFlag.currentUser.user_id}"); + Debug.Log($"是否是player{data.r3 == GlobalFlag.currentUser.user_id}"); if (data.r3 == GlobalFlag.currentUser.user_id) { device.GetComponent().isPlayer = true; diff --git a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs index 679ef310..d0ad9d20 100644 --- a/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs +++ b/Assets/Zion/Scripts/ModelFunction/UAV/UnmannedAerialVehicleManage.cs @@ -252,7 +252,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour } - + public Action> WRJAttach; public void SwitchWRJModel() { gxWRJCamera.gameObject.SetActive(false); @@ -262,6 +262,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour gxWRJCamera.gameObject.SetActive(true); break; case WRJModel.电子侦察无人机: + WRJAttach += SetCollider4WRJ; break; case WRJModel.自杀式无人机: break; @@ -275,30 +276,44 @@ public class UnmannedAerialVehicleManage : MonoBehaviour private void SelectiveAttackDrone() { if (isEngagedTarget) return; - List colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体 - List colliders1 = new List(); - for (int i = 0; i < colliders.Count; i++) + if (wrjModel == WRJModel.电子侦察无人机 || wrjModel == WRJModel.光学无人机) { - if (colliders[i].transform.tag == "AttackTarget") - colliders1.Add(colliders[i]); - } - - - - if (colliders1.Count > 0) - { - 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); - SendMsg(colliders1[_number].transform); - for (int i = 0; i < _unmannedAerialVehicles.Count; i++) + List colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体 + List attackColliders1 = new List(); + for (int i = 0; i < colliders.Count; i++) { - _unmannedAerialVehicles[i].AttAck(colliders1[_number].transform); + if (colliders[i].transform.tag == "AttackTarget") + attackColliders1.Add(colliders[i]); + } + + if (wrjModel == WRJModel.光学无人机) + { + if (attackColliders1.Count > 0) + { + isEngagedTarget = true; + //colliders1.ForEach(x => Debug.Log(x.transform.name)); + int _number = UnityEngine.Random.Range(0, attackColliders1.Count - 1); + List _unmannedAerialVehicles = unmannedAerialVehicles.FindAll(x => x != null && x.gameObject.activeSelf); + SendMsg(attackColliders1[_number].transform); + for (int i = 0; i < _unmannedAerialVehicles.Count; i++) + { + _unmannedAerialVehicles[i].AttAck(attackColliders1[_number].transform); + } + } + } + + if (wrjModel == WRJModel.电子侦察无人机) + { + WRJAttach.Invoke(attackColliders1); } } } + public void SetCollider4WRJ(List attackColliders) + { + DeviceManager.Instance.SetCollider4WRJ(attackColliders); + } + public void SendMsg(Transform attackTarget) { string nowData = GetSyncData(attackTarget); @@ -444,18 +459,22 @@ public class UnmannedAerialVehicleManage : MonoBehaviour break; } - ///根据风得速度改变无人机得速度 - FireSpeed = float.Parse(maximumFlyingSpeed) / float.Parse(currentSceneInfo.EnvWindSpeed); - /////如果风速大于6级,无人机停止飞行 - if (float.Parse(currentSceneInfo.EnvWindSpeed) * 10 > 6) + if (string.IsNullOrEmpty(currentSceneInfo.EnvWindSpeed)) { - FireSpeed = 0; + ///根据风得速度改变无人机得速度 + FireSpeed = float.Parse(maximumFlyingSpeed) / float.Parse(currentSceneInfo.EnvWindSpeed); + /////如果风速大于6级,无人机停止飞行 + if (float.Parse(currentSceneInfo.EnvWindSpeed) * 10 > 6) + { + FireSpeed = 0; + } } CheckRSC(); if (i == (weaponitemone.Count - 1)) { StartCoroutine(WeaponitemoneDataAddition()); } + SwitchWRJModel(); } } /// @@ -463,14 +482,17 @@ public class UnmannedAerialVehicleManage : MonoBehaviour /// public void CheckRSC() { - float rcs = float.Parse(RCS); - if (rcs <= 0.5 && rcs >= 0.1) + if (string.IsNullOrEmpty(RCS)) { - StartCoroutine(ShowRadarTips(0.8f, 2)); - } - else if (rcs >= 0.5f && rcs <= 1) - { - StartCoroutine(ShowRadarTips(0.4f, 1)); + 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)); + } } } /// @@ -539,9 +561,6 @@ public class UnmannedAerialVehicleManage : MonoBehaviour } - - - /// /// 单个无人机数据写入 ///