This commit is contained in:
yulong 2024-01-19 14:35:27 +08:00
commit d77afc8e5b
8 changed files with 225 additions and 75 deletions

View File

@ -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}

View File

@ -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}

View File

@ -1 +1 @@
192.168.107.15:48888
127.0.0.1:48888

View File

@ -1 +1 @@
192.168.107.15
127.0.0.1

View File

@ -80,6 +80,47 @@ public class DeviceManager : MonoSingleton<DeviceManager>
devices.Add(d);
}
}
/// <summary>
/// 获取光学无人机和自杀式无人机
/// </summary>
/// <returns></returns>
public List<UnmannedAerialVehicleManage> GetGXWRJAndZSWRJ()
{
List<UnmannedAerialVehicleManage> tempUAM = new List<UnmannedAerialVehicleManage>();
for (int i = 0; i < devices.Count; i++)
{
if (devices[i] != null && devices[i].gameObject.name.Contains("无人机"))
{
UnmannedAerialVehicleManage temp = devices[i].GetComponent<UnmannedAerialVehicleManage>();
if (temp != null)
{
if (temp.wrjModel == WRJModel. || temp.wrjModel == WRJModel.)
tempUAM.Add(temp);
}
}
}
return tempUAM;
}
public void SetCollider4WRJ(List<Collider> attackColliders)
{
int _number = Random.Range(0, attackColliders.Count - 1);
if (attackColliders.Count > 0)
{
List<UnmannedAerialVehicleManage> 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)
{

View File

@ -377,8 +377,14 @@ public class GameManager : MonoSingleton<GameManager>
if (device.GetComponent<UnmannedAerialVehicleManage>())
device.GetComponent<UnmannedAerialVehicleManage>().wrjModel = (WRJModel)wrjModelCount;
}
device.GetComponent<EquipmentCommon>().deviceID = data.id;
device.GetComponent<EquipmentCommon>().FillInTheData(data.list_para);
Debug.Log($"<color=yellow>是否是player{data.r3 == GlobalFlag.currentUser.user_id}</color>");
if (data.r3 == GlobalFlag.currentUser.user_id)
{
device.GetComponent<EquipmentCommon>().isPlayer = true;
}
}
private void OnGetRoomUsers(string obj)

View File

@ -135,7 +135,7 @@ public class EquipmentCommon : MonoBehaviour
replaceInfoDic.Add("r1", $"{transform.position.x},{transform.position.y},{transform.position.z},{transform.eulerAngles.x},{transform.eulerAngles.y},{transform.eulerAngles.z}");
if (gameObject.GetComponent<UnmannedAerialVehicleManage>())
replaceInfoDic.Add("r2", ((int)gameObject.GetComponent<UnmannedAerialVehicleManage>().wrjModel).ToString());
//replaceInfoDic.Add("r3",);
replaceInfoDic.Add("r3", GlobalFlag.currentUser.user_id);
StartCoroutine(AsyncWebReq.PostData2(Url_AddDeviceAndGetDeviceId, replaceInfoDic, ResultsInfo =>
{
ReturnDeviceID returnID = JsonConvert.DeserializeObject<ReturnDeviceID>(ResultsInfo);

View File

@ -252,7 +252,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
}
public Action<List<Collider>> 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<Collider> colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体
List<Collider> colliders1 = new List<Collider>();
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<UnmannedAerialVehicle> _unmannedAerialVehicles = unmannedAerialVehicles.FindAll(x => x != null && x.gameObject.activeSelf);
SendMsg(colliders1[_number].transform);
for (int i = 0; i < _unmannedAerialVehicles.Count; i++)
List<Collider> colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体
List<Collider> attackColliders1 = new List<Collider>();
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<UnmannedAerialVehicle> _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<Collider> 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();
}
}
/// <summary>
@ -463,14 +482,17 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
/// </summary>
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));
}
}
}
/// <summary>
@ -539,9 +561,6 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
}
/// <summary>
/// 单个无人机数据写入
/// </summary>