Compare commits
2 Commits
c758e6e8c4
...
e53c14a301
Author | SHA1 | Date |
---|---|---|
|
e53c14a301 | |
|
cddd86a5ad |
|
@ -0,0 +1,20 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
/// <summary>
|
||||
/// 电子侦察无人机
|
||||
/// </summary>
|
||||
public class ElectronicReconnaissanceDrone : UAVBase
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ddc1db5913d56ec47ac93953631c9a82
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,27 @@
|
|||
using PData;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 无人机基类
|
||||
/// </summary>
|
||||
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));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1acac6355624a274ea601506c5f2a3ff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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<GameManager>
|
|||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 启动暂停
|
||||
/// <summary>
|
||||
/// 导条变化调用
|
||||
|
@ -305,91 +305,13 @@ public class TerrestrialRadioInterferenceManger : MonoBehaviour
|
|||
{
|
||||
if (colliders[i].transform.tag == "WRJ")
|
||||
{
|
||||
UnmannedAerialVehicle unmannedAerialVehicle = null;
|
||||
if (colliders[i].GetComponent<UnmannedAerialVehicle>())
|
||||
{
|
||||
unmannedAerialVehicle = colliders[i].GetComponent<UnmannedAerialVehicle>();
|
||||
}
|
||||
UnmannedAerialVehicleManage unmannedAerialVehicleManage = null;
|
||||
if (colliders[i].GetComponent<UnmannedAerialVehicleManage>())
|
||||
{
|
||||
unmannedAerialVehicleManage = colliders[i].GetComponent<UnmannedAerialVehicleManage>();
|
||||
}
|
||||
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
|
|||
/// <exception cref="NotImplementedException"></exception>
|
||||
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")
|
||||
|
|
|
@ -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
|
|||
/// </summary>
|
||||
public bool isEngagedTarget = false;
|
||||
|
||||
/// <summary>
|
||||
/// 光学无人机
|
||||
/// </summary>
|
||||
public Camera gxWRJCamera;
|
||||
|
||||
#region 无人机数据
|
||||
/// <summary>
|
||||
/// 续航时间
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 攻击打击
|
||||
/// </summary>
|
||||
|
@ -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<UnmannedAerialVehicle> _unmannedAerialVehicles = unmannedAerialVehicles.FindAll(x => x != null&&x.gameObject.activeSelf);
|
||||
List<UnmannedAerialVehicle> _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());
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 雷达检测无人机身上得RSC
|
||||
/// </summary>
|
||||
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));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 多少时间在对方雷达界面上显示红色标记
|
||||
/// </summary>
|
||||
/// <param name="minTime"></param>
|
||||
/// <param name="maxTime"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测无线电频率
|
||||
/// </summary>
|
||||
/// <param name="interferingFrequency">无线电数据</param>
|
||||
/// <param name="interferenceMode">驱离或者迫降</param>
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单个无人机数据写入
|
||||
|
@ -455,6 +576,9 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region 阵型编队
|
||||
/// <summary>
|
||||
/// 阵型选择
|
||||
|
@ -694,6 +818,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
Destroy(airRoute.gameObject);
|
||||
OnActivationChanged -= OnActivationChangedHandler;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue