This commit is contained in:
yulong 2024-03-28 14:08:11 +08:00
parent eedc7a9cac
commit 071fe49e58
3 changed files with 53 additions and 39 deletions

View File

@ -1486,8 +1486,8 @@ BoxCollider:
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 3.1049147, y: 0.9711163, z: 3.155058} m_Size: {x: 3.6864724, y: 1.2080312, z: 3.8562632}
m_Center: {x: 0.060157776, y: 1.1136094, z: 0.13353431} m_Center: {x: 0.09509891, y: 1.1254551, z: 0.1453805}
--- !u!114 &4138683085727570685 --- !u!114 &4138683085727570685
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -158,6 +158,10 @@ public class LaserFireControlPlatformManger : MonoBehaviour
/// 判断物体是否在相机里面 /// 判断物体是否在相机里面
/// </summary> /// </summary>
public bool ispcamera; public bool ispcamera;
/// <summary>
/// 激光武器攻击时间
/// </summary>
public static float timer;
void Start() void Start()
{ {
equipmentCommon = GetComponent<EquipmentCommon>(); equipmentCommon = GetComponent<EquipmentCommon>();
@ -225,6 +229,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
StorageIntervalTime = weaponitemone[i].para_value; StorageIntervalTime = weaponitemone[i].para_value;
lasertime = float.Parse(StorageIntervalTime); lasertime = float.Parse(StorageIntervalTime);
storageIntervalTime = float.Parse(StorageIntervalTime); storageIntervalTime = float.Parse(StorageIntervalTime);
timer = storageIntervalTime;
break; break;
case "毁伤目标累积作用时间:": case "毁伤目标累积作用时间:":
CumulativeActionTimeOfDamageTarget = weaponitemone[i].para_value; CumulativeActionTimeOfDamageTarget = weaponitemone[i].para_value;
@ -234,7 +239,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
Receivingdistance = float.Parse(InterferenceDistance) * 1000; Receivingdistance = float.Parse(InterferenceDistance) * 1000;
break; break;
case "干扰角度": case "瞬时视场":
InterferenceAngle = weaponitemone[i].para_value; InterferenceAngle = weaponitemone[i].para_value;
break; break;
default: default:
@ -271,11 +276,11 @@ public class LaserFireControlPlatformManger : MonoBehaviour
if (targetPoint != null && Receivingdistance > 0) if (targetPoint != null && Receivingdistance > 0)
{ {
Vector3 pos = camera.WorldToViewportPoint(targetPoint.position); Vector3 pos = camera.WorldToViewportPoint(targetPoint.position);
Debug.Log("攻击目标距离"+Vector3.Distance(targetPoint.position, transform.position)); Debug.Log("攻击目标距离" + Vector3.Distance(targetPoint.position, transform.position));
ispcamera = (pos.x > 0 && pos.x < 1 && pos.y > 0 && pos.y < 1 && pos.z > 0); ispcamera = (pos.x > 0 && pos.x < 1 && pos.y > 0 && pos.y < 1 && pos.z > 0);
if (Vector3.Distance(targetPoint.position, transform.position)< Receivingdistance&&ispcamera) if (Vector3.Distance(targetPoint.position, transform.position) < Receivingdistance && ispcamera)
{ {
Debug.LogError("出现在摄像机视角里面了"); Debug.Log("出现在摄像机视角里面了");
Vector3 cector = targetPoint.position - transform.position; Vector3 cector = targetPoint.position - transform.position;
float angle = Vector3.Angle(cector, transform.forward); float angle = Vector3.Angle(cector, transform.forward);
if (float.Parse(InterferenceAngle) > angle) if (float.Parse(InterferenceAngle) > angle)

View File

@ -222,9 +222,15 @@ public class RadarManger : MonoBehaviour
while (true) while (true)
{ {
//Debug.Log("Timer fired at: " + Time.time); //Debug.Log("Timer fired at: " + Time.time);
yield return new WaitForSeconds(5); // 等待一段时间后继续执行
if (LaserFireControlPlatformManger.timer>0)
{
yield return new WaitForSeconds(LaserFireControlPlatformManger.timer); // 等待一段时间后继续执行
RetrievalUAV(); RetrievalUAV();
}
//Deadzone(); //Deadzone();
} }
} }
@ -335,7 +341,9 @@ public class RadarManger : MonoBehaviour
{ {
for (int i = 0; i < targets.Count; i++) for (int i = 0; i < targets.Count; i++)
{ {
UnmannedAerialVehicle unmannedAerialVehicle = targets[i].GetComponent<UnmannedAerialVehicle>(); if (targets != null)
{
UnmannedAerialVehicle unmannedAerialVehicle = targets[i].transform.Find("无人机").GetComponent<UnmannedAerialVehicle>();
if (unmannedAerialVehicle) if (unmannedAerialVehicle)
{ {
bool isnearBlindArea = Vector3.Distance(transform.position, unmannedAerialVehicle.transform.position) > nearBlindArea; bool isnearBlindArea = Vector3.Distance(transform.position, unmannedAerialVehicle.transform.position) > nearBlindArea;
@ -360,6 +368,7 @@ public class RadarManger : MonoBehaviour
} }
} }
} }
}
#region #region
// public List<Collider> colliders = new List<Collider>(); // public List<Collider> colliders = new List<Collider>();
@ -478,9 +487,9 @@ public class RadarManger : MonoBehaviour
/// </summary> /// </summary>
public bool GetQualifiedEquipment(GameObject obj) public bool GetQualifiedEquipment(GameObject obj)
{ {
if(obj.GetComponent<UnmannedAerialVehicleManage>() if (obj.GetComponent<UnmannedAerialVehicleManage>()
&& obj.GetComponent<UnmannedAerialVehicleManage>().GetRCS() > rcs && obj.GetComponent<UnmannedAerialVehicleManage>().GetRCS() > rcs
&& Vector3.Distance(transform.position,obj.transform.position)> float.Parse(NearBlindArea)) && Vector3.Distance(transform.position, obj.transform.position) > float.Parse(NearBlindArea))
return true; return true;
else else
return false; return false;