Merge branch 'master' of http://git.umayle.com:2023/yulong/NewN_UAVPlane
This commit is contained in:
commit
48a4c44185
|
@ -38,7 +38,7 @@ RenderSettings:
|
|||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 1113159741}
|
||||
m_IndirectSpecularColor: {r: 0.1721589, g: 0.30467987, b: 0.5980986, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.16286224, g: 0.30626324, b: 0.6662026, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
|
@ -37132,12 +37132,12 @@ PrefabInstance:
|
|||
- target: {fileID: 7828191145763698017, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_MethodName
|
||||
value: SetActive
|
||||
value: SwitchModelScale
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191145763698017, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_Mode
|
||||
value: 6
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191145763698017, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
|
@ -37187,12 +37187,12 @@ PrefabInstance:
|
|||
- target: {fileID: 7828191145835787467, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_MethodName
|
||||
value: SetActive
|
||||
value: SwitchModelScale
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191145835787467, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_Mode
|
||||
value: 6
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191145835787467, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
|
@ -37242,12 +37242,12 @@ PrefabInstance:
|
|||
- target: {fileID: 7828191145920499402, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_MethodName
|
||||
value: SetActive
|
||||
value: SwitchModelScale
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191145920499402, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_Mode
|
||||
value: 6
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191145920499402, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
|
@ -37407,7 +37407,7 @@ PrefabInstance:
|
|||
- target: {fileID: 7828191146970283770, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_Mode
|
||||
value: 6
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146970283770, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
|
@ -37422,7 +37422,7 @@ PrefabInstance:
|
|||
- target: {fileID: 7828191146970283770, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_MethodName
|
||||
value: SetActive
|
||||
value: SwitchModelScale
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191146970283770, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
|
@ -37462,12 +37462,12 @@ PrefabInstance:
|
|||
- target: {fileID: 7828191147017850482, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_MethodName
|
||||
value: SetActive
|
||||
value: SwitchModelScale
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191147017850482, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[2].m_Mode
|
||||
value: 6
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7828191147017850482, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
|
@ -37512,12 +37512,18 @@ RectTransform:
|
|||
type: 3}
|
||||
m_PrefabInstance: {fileID: 729007800}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &729007802 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7828191146020959763, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
--- !u!114 &729007802 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 7828191146020959853, guid: 49c7b765b5b8a8845aad4c0acd9753a8,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 729007800}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 553d6fe9e2be1ee448fbaa6b5a91ac39, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &732495660
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -63564,7 +63570,7 @@ MonoBehaviour:
|
|||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
randSeed: 9799953
|
||||
randSeed: 104423687
|
||||
isDoingTransition: 0
|
||||
minimumHeight: 0
|
||||
--- !u!114 &1820978574
|
||||
|
|
|
@ -162,7 +162,6 @@ public class GameManager : MonoSingleton<GameManager>
|
|||
{
|
||||
SetWeatherValue();
|
||||
SetModelValue();
|
||||
|
||||
string msg = "getroomusers ";
|
||||
_ = SyncCreateRoom.SendMessageAsync(msg);
|
||||
}
|
||||
|
@ -175,7 +174,6 @@ public class GameManager : MonoSingleton<GameManager>
|
|||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hitInfo;
|
||||
if (Physics.Raycast(ray, out hitInfo, 1000))
|
||||
|
||||
{
|
||||
if (hitInfo.collider.tag == "WRJ")
|
||||
{
|
||||
|
@ -373,9 +371,12 @@ public class GameManager : MonoSingleton<GameManager>
|
|||
|
||||
device.transform.position = new Vector3(float.Parse(deviceTran[0]), float.Parse(deviceTran[1]), float.Parse(deviceTran[2]));
|
||||
device.transform.eulerAngles = new Vector3(float.Parse(deviceTran[3]), float.Parse(deviceTran[4]), float.Parse(deviceTran[5]));
|
||||
int wrjModelCount = int.Parse(data.r2);
|
||||
if (device.GetComponent<UnmannedAerialVehicleManage>())
|
||||
device.GetComponent<UnmannedAerialVehicleManage>().wrjModel = (WRJModel)wrjModelCount;
|
||||
if (!string.IsNullOrEmpty(data.r2) || data.r2 != "")
|
||||
{
|
||||
int wrjModelCount = int.Parse(data.r2);
|
||||
if (device.GetComponent<UnmannedAerialVehicleManage>())
|
||||
device.GetComponent<UnmannedAerialVehicleManage>().wrjModel = (WRJModel)wrjModelCount;
|
||||
}
|
||||
device.GetComponent<EquipmentCommon>().deviceID = data.id;
|
||||
device.GetComponent<EquipmentCommon>().FillInTheData(data.list_para);
|
||||
}
|
||||
|
|
|
@ -33,14 +33,14 @@ namespace Assets.Zion.Scripts.Adam
|
|||
currentWRJ = hitInfo.collider.GetComponent<WRJController>();
|
||||
if (!wRJControllers.Contains(currentWRJ))
|
||||
wRJControllers.Add(currentWRJ);
|
||||
wrjMenuSetPanel.gameObject.SetActive(true);
|
||||
wrjMenuSetPanel.localScale = Vector3.one;
|
||||
Vector3 posItem = GetScreenPosition(hitInfo.collider.gameObject);
|
||||
wrjMenuSetPanel.anchoredPosition = new Vector3(posItem.x + 100f, posItem.y, posItem.z);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wrjMenuSetPanel.gameObject.SetActive(false);
|
||||
wrjMenuSetPanel.localScale = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +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",);
|
||||
StartCoroutine(AsyncWebReq.PostData2(Url_AddDeviceAndGetDeviceId, replaceInfoDic, ResultsInfo =>
|
||||
{
|
||||
ReturnDeviceID returnID = JsonConvert.DeserializeObject<ReturnDeviceID>(ResultsInfo);
|
||||
|
|
|
@ -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>
|
||||
|
@ -259,17 +282,18 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
if (colliders[i].transform.tag == "AttackTarget")
|
||||
colliders1.Add(colliders[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (colliders1.Count > 0)
|
||||
{
|
||||
isEngagedTarget = true;
|
||||
colliders1.ForEach(x => Debug.Log(x.transform.name));
|
||||
//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++)
|
||||
{
|
||||
Debug.Log(_unmannedAerialVehicles[i].transform.name);
|
||||
_unmannedAerialVehicles[i].AttAck(colliders1[_number].transform);
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +313,6 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
{
|
||||
return string.Format("{0},{1},{2},{3},{4}", "SingleDronePosition", equipmentCommon.deviceID,
|
||||
attackTarget.position.x, attackTarget.position.y, attackTarget.position.z);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -321,12 +344,8 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
/// <param name="weaponitemone"></param>
|
||||
public void FillInTheData(List<List_paraItem> weaponitemone)
|
||||
{
|
||||
//if (equipmentCommon)
|
||||
//{
|
||||
// string msg = $"send2room {equipmentCommon.equipmentType}+{transform.position.ToString().Replace(" ", "").Replace("(", "").Replace(")", "")}+{transform.eulerAngles.ToString().Replace(" ", "").Replace("(", "").Replace(")", "")}";
|
||||
// Debug.Log(msg);
|
||||
// _ = SyncCreateRoom.SendMessageAsync(msg);
|
||||
//}
|
||||
SenceInfo currentSceneInfo = new SenceInfo();
|
||||
currentSceneInfo = UIBootstrap.Instance.currentSceneInfo.data;
|
||||
for (int i = 0; i < weaponitemone.Count; i++)
|
||||
{
|
||||
switch (weaponitemone[i].para_name)
|
||||
|
@ -339,7 +358,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
break;
|
||||
case "最大飞行速度:":
|
||||
maximumFlyingSpeed = weaponitemone[i].para_value;
|
||||
FireSpeed = float.Parse(maximumFlyingSpeed);
|
||||
|
||||
break;
|
||||
case "RCS:":
|
||||
RCS = weaponitemone[i].para_value;
|
||||
|
@ -424,12 +443,104 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
///根据风得速度改变无人机得速度
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <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>
|
||||
/// 单个无人机数据写入
|
||||
|
@ -457,6 +568,9 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region 阵型编队
|
||||
/// <summary>
|
||||
/// 阵型选择
|
||||
|
@ -696,8 +810,9 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
|||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
Destroy(airRoute.gameObject);
|
||||
StopCoroutine(ShowRadarTips(0, 0));
|
||||
OnActivationChanged -= OnActivationChangedHandler;
|
||||
Destroy(airRoute.gameObject);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ public class UnmannedAerialVehicleUI : MonoBehaviour
|
|||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -51,10 +51,15 @@ public class UnmannedAerialVehicleUI : MonoBehaviour
|
|||
if (unmannedAerialVehicleManage.airRoute)
|
||||
unmannedAerialVehicleManage.airRoute.transform.localScale = Vector3.zero;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void SwitchModelScale(float scale)
|
||||
{
|
||||
transform.localScale = new Vector3(scale, scale, scale);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切换模式
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue