无人机视角修改

This commit is contained in:
yulong 2024-02-26 18:04:59 +08:00
parent 96e8c51844
commit 1ad647b2e3
8 changed files with 160 additions and 26 deletions

View File

@ -22253,6 +22253,11 @@ PrefabInstance:
propertyPath: m_Layer
value: 12
objectReference: {fileID: 0}
- target: {fileID: 1211343198027249645, guid: 1f803842203167d4aa8e14297954d6f2,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1565820973654412168, guid: 1f803842203167d4aa8e14297954d6f2,
type: 3}
propertyPath: m_Layer

View File

@ -724,6 +724,8 @@ MonoBehaviour:
pattern: 0
interval: 5
equipmentCommon: {fileID: -7238547075891962512}
groupId: -1
isGroup: 0
UAVPrefab: {fileID: 7985558213978141209, guid: 088baeb890d17754287a1161c0b1dceb,
type: 3}
totalObjects: 1
@ -1041,7 +1043,7 @@ PrefabInstance:
- target: {fileID: 5698306997877693391, guid: 91b685a7f0a6f7643b8ae61842f883de,
type: 3}
propertyPath: m_LocalScale.x
value: 30
value: 120
objectReference: {fileID: 0}
- target: {fileID: 5698306997877693391, guid: 91b685a7f0a6f7643b8ae61842f883de,
type: 3}
@ -1051,7 +1053,7 @@ PrefabInstance:
- target: {fileID: 5698306997877693391, guid: 91b685a7f0a6f7643b8ae61842f883de,
type: 3}
propertyPath: m_LocalScale.z
value: 30
value: 120
objectReference: {fileID: 0}
- target: {fileID: 8500934962979638684, guid: 91b685a7f0a6f7643b8ae61842f883de,
type: 3}
@ -2668,7 +2670,7 @@ PrefabInstance:
- target: {fileID: 5698306997877693391, guid: 91b685a7f0a6f7643b8ae61842f883de,
type: 3}
propertyPath: m_LocalScale.x
value: 30
value: 120
objectReference: {fileID: 0}
- target: {fileID: 5698306997877693391, guid: 91b685a7f0a6f7643b8ae61842f883de,
type: 3}
@ -2678,7 +2680,7 @@ PrefabInstance:
- target: {fileID: 5698306997877693391, guid: 91b685a7f0a6f7643b8ae61842f883de,
type: 3}
propertyPath: m_LocalScale.z
value: 30
value: 120
objectReference: {fileID: 0}
- target: {fileID: 8500934962979638684, guid: 91b685a7f0a6f7643b8ae61842f883de,
type: 3}

View File

@ -735,7 +735,7 @@ MonoBehaviour:
toggle6: {fileID: 6251437642903478223}
toggle7: {fileID: 117463751223528660}
Frequency:
camera: {fileID: 480111845}
Camera1: {fileID: 480111845}
rawImage: {fileID: 1115657768}
colliders: []
attackColliders1: []

View File

@ -90,7 +90,7 @@ public class Spectrumdetection : MonoBehaviour
/// <summary>
/// 摄像机显示层数
/// </summary>
public Camera camera;
public Camera Camera1;
/// <summary>
///
/// </summary>
@ -99,8 +99,13 @@ public class Spectrumdetection : MonoBehaviour
///
/// </summary>
private bool onlyOne = true;
/// <summary>
/// 接收探测范围
/// </summary>
public static float Radius;
void Start()
{
Camera1.gameObject.SetActive(false);
spectrumdetections.Add(this);
equipmentCommon = GetComponent<EquipmentCommon>();
@ -113,13 +118,16 @@ public class Spectrumdetection : MonoBehaviour
void Update()
{
if (onlyOne && equipmentCommon.deviceID.Length > 10)
{
onlyOne = false;
DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, camera, rawImage);
}
//if (onlyOne && equipmentCommon.deviceID.Length > 10)
//{
// onlyOne = false;
// DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, camera, rawImage);
//}
if (isStartRehearsing)
{
Camera1.gameObject.SetActive(true);
Search();//微波武器朝向无人机
}
}
private void Microwave()
{
@ -132,7 +140,7 @@ public class Spectrumdetection : MonoBehaviour
if (ison)
{
Frequency = "UHF";
camera.cullingMask = 1 << 16;
Camera1.cullingMask = 1 << 16;
SweepFrequencyBandTo();
}
});
@ -141,7 +149,7 @@ public class Spectrumdetection : MonoBehaviour
if (ison)
{
Frequency = "L";
camera.cullingMask = 1 << 17;
Camera1.cullingMask = 1 << 17;
SweepFrequencyBandTo();
}
});
@ -150,7 +158,7 @@ public class Spectrumdetection : MonoBehaviour
if (ison)
{
Frequency = "S";
camera.cullingMask = 1 << 18;
Camera1.cullingMask = 1 << 18;
SweepFrequencyBandTo();
}
});
@ -159,7 +167,7 @@ public class Spectrumdetection : MonoBehaviour
if (ison)
{
Frequency = "C";
camera.cullingMask = 1 << 19;
Camera1.cullingMask = 1 << 19;
SweepFrequencyBandTo();
}
});
@ -168,7 +176,7 @@ public class Spectrumdetection : MonoBehaviour
if (ison)
{
Frequency = "X";
camera.cullingMask = 1 << 20;
Camera1.cullingMask = 1 << 20;
SweepFrequencyBandTo();
}
});
@ -177,7 +185,7 @@ public class Spectrumdetection : MonoBehaviour
if (ison)
{
Frequency = "Ku";
camera.cullingMask = 1 << 21;
Camera1.cullingMask = 1 << 21;
SweepFrequencyBandTo();
}
});
@ -186,7 +194,7 @@ public class Spectrumdetection : MonoBehaviour
if (ison)
{
Frequency = "Ka";
camera.cullingMask = (1 << 22);
Camera1.cullingMask = (1 << 22);
SweepFrequencyBandTo();
}
});
@ -203,7 +211,7 @@ public class Spectrumdetection : MonoBehaviour
{
int layerValue = LayerMask.NameToLayer(_frequency);
Frequency = _frequency;
camera.cullingMask = (1 << layerValue);
Camera1.cullingMask = (1 << layerValue);
}
/// <summary>
/// 设置扫描频段同步
@ -264,6 +272,8 @@ public class Spectrumdetection : MonoBehaviour
{
case "探测距离:":
Detectionrange = weaponitemone[i].para_value;
Radius = float.Parse(Detectionrange);
Camera1.orthographicSize = Radius * 1000;
break;
case "批目标处理能力:":
Batchcapacity = weaponitemone[i].para_value;
@ -368,7 +378,7 @@ public class Spectrumdetection : MonoBehaviour
private void Search()
{
attackColliders1.Clear();
colliders = Physics.OverlapSphere(transform.position, float.Parse(Detectionrange) * 100);
colliders = Physics.OverlapSphere(transform.position, float.Parse(Detectionrange) * 1000);
for (int i = 0; i < colliders.Length; i++)
{
if (colliders[i].transform.gameObject.tag == "WRJ")

View File

@ -75,6 +75,7 @@ public class HighPriorityTarget : MonoBehaviour
public GameObject gamepos;
void Start()
{
gamepos.gameObject.SetActive(false);
HighPriorityTargets.Add(this);
Number = HighPriorityTargets.Count.ToString();
buttonreg.onClick.AddListener(() =>
@ -141,6 +142,24 @@ public class HighPriorityTarget : MonoBehaviour
}
}
}
if (Spectrumdetection.Radius > 0)
{
gamepos.gameObject.SetActive(true);
switch (Spectrumdetection.Radius)
{
case 1:
gamepos.transform.localScale = new Vector3(8, 1, 8);
break;
case 2:
gamepos.transform.localScale = new Vector3(16, 1, 16);
break;
case 3:
gamepos.transform.localScale = new Vector3(24, 1, 24);
break;
default:
break;
}
}
}
/// <summary>

View File

@ -136,9 +136,14 @@ public class RadarManger : MonoBehaviour
///
/// </summary>
private bool onlyOne = true;
/// <summary>
/// 接收无人机显示在地图上的参数大小
/// </summary>
public float Mapsize;
void Awake()
{
//失活摄像机
minCamera.gameObject.SetActive(false);
}
void Start()
{
@ -152,13 +157,41 @@ public class RadarManger : MonoBehaviour
void Update()
{
//老师点了开始演习就激活摄像机
if (isStartRehearsing)
{
minCamera.gameObject.SetActive(true);
}
if (onlyOne && equipmentCommon.deviceID.Length > 10)
{
onlyOne = false;
DroneViewDisplay.Instance.CreateUI(equipmentCommon.deviceID, minCamera, rawImage);
}
Deadzone();//雷达盲区
if (Mapsize >1)
{
Dotsize();//改变雷达地图上显示无人机大小
}
}
private void Dotsize()
{
GameObject[] wrjdtdx = GameObject.FindGameObjectsWithTag("WRJ");
for (int i = 0; i < wrjdtdx.Length; i++)
{
if (wrjdtdx[i].gameObject.tag=="WRJ"&& equipmentCommon.isPlayer)
{
UnmannedAerialVehicleManage unmannedAerialVehicleManage = wrjdtdx[i].GetComponent<UnmannedAerialVehicleManage>();
if (unmannedAerialVehicleManage)
{
unmannedAerialVehicleManage.gamemap.transform.localScale = new Vector3(Mapsize,1,Mapsize);
Debug.Log("改变了无人机显示大小");
}
}
}
}
/// <summary>
/// 雷达盲区让目标消失在地图上
/// </summary>
@ -262,12 +295,13 @@ public class RadarManger : MonoBehaviour
break;
case "探测距离:":
DetectionRange = weaponitemone[i].para_value;
Showmap(float.Parse(DetectionRange));
detectionRadius = float.Parse(DetectionRange) * 1000;
minCamera.orthographicSize = detectionRadius;
break;
case "近盲区:":
NearBlindArea = weaponitemone[i].para_value;
Debug.LogError(NearBlindArea);
//Debug.LogError(NearBlindArea);
nearBlindArea = float.Parse(DetectionRange);
break;
case "批量标处理能力:":
@ -298,6 +332,30 @@ public class RadarManger : MonoBehaviour
}
}
private void Showmap(float size)
{
switch (size)
{
case 1:
Mapsize = 24;
break;
case 2:
Mapsize = 48;
break;
case 3:
Mapsize = 72;
break;
case 4:
Mapsize = 96;
break;
case 5:
Mapsize = 120;
break;
default:
break;
}
}
/// <summary>
/// 雷达转动速度
/// </summary>

View File

@ -174,9 +174,14 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
/// 显示在雷达上的位置
/// </summary>
public GameObject gamemap;
/// <summary>
/// 频谱显示无人机大小
/// </summary>
public float reveal;
// Start is called before the first frame update
void Start()
{
gamePos.gameObject.SetActive(false);
MatrixFormation(30, 1);
for (int i = 0; i < unmannedAerialVehicles.Count; i++)
{
@ -198,7 +203,15 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
{
toggle.onValueChanged.AddListener(delegate { SurveillanceFrequencyBandsValueChanged(toggle); });
}
}
private void Mapdisplay()
{
if (reveal>1)
{
gamePos.transform.localScale = new Vector3(reveal, 1, reveal);
}
}
/// <summary>
@ -265,6 +278,10 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
// Update is called once per frame
void Update()
{
if (isStartRehearsing)
{
gamePos.gameObject.SetActive(true);
}
if (isStartRehearsing && equipmentCommon.isPlayer)
{
switch (pattern)
@ -300,6 +317,28 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
Destroy(gameObject);
}));
}
if (Spectrumdetection.Radius > 0)
{
gxWRJCamera.orthographicSize = Spectrumdetection.Radius * 1000;
dzWRJCamera.orthographicSize = Spectrumdetection.Radius * 1000;
switch (Spectrumdetection.Radius)
{
case 1:
reveal = 24;
Mapdisplay();
break;
case 2:
reveal = 48;
Mapdisplay();
break;
case 3:
reveal = 72;
Mapdisplay();
break;
default:
break;
}
}
}
/// <summary>
@ -376,9 +415,10 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
{
//if (isEngagedTarget) return;
//if (wrjModel == WRJModel.电子侦察无人机 || wrjModel == WRJModel.光学无人机)
if (wrjModel == WRJModel.)
{
List<Collider> allColliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体
List<Collider> allColliders = Physics.OverlapSphere(transform.position, Spectrumdetection.Radius*1000).ToList(); // 检索范围内的所有碰撞体
for (int i = 0; i < allColliders.Count; i++)
{
if (allColliders[i].gameObject.tag == "AttackTarget"
@ -394,7 +434,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
}
else if (wrjModel == WRJModel.)
{
List<Collider> allColliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体
List<Collider> allColliders = Physics.OverlapSphere(transform.position, Spectrumdetection.Radius*1000).ToList(); // 检索范围内的所有碰撞体
for (int i = 0; i < allColliders.Count; i++)
{
if (allColliders[i].gameObject.tag == "AttackTarget" && !allColliders[i].isTrigger && !attackColliders1.Contains(allColliders[i]))

View File

@ -42,7 +42,7 @@ PlayerSettings:
m_SplashScreenLogos: []
m_VirtualRealitySplashScreen: {fileID: 0}
m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 960
defaultScreenWidth: 900
defaultScreenHeight: 540
defaultScreenWidthWeb: 960
defaultScreenHeightWeb: 600
@ -90,7 +90,7 @@ PlayerSettings:
xboxEnableKinectAutoTracking: 0
xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
allowFullscreenSwitch: 0
fullscreenMode: 3
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0