This commit is contained in:
parent
eedc7a9cac
commit
071fe49e58
|
@ -1486,8 +1486,8 @@ BoxCollider:
|
|||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 3.1049147, y: 0.9711163, z: 3.155058}
|
||||
m_Center: {x: 0.060157776, y: 1.1136094, z: 0.13353431}
|
||||
m_Size: {x: 3.6864724, y: 1.2080312, z: 3.8562632}
|
||||
m_Center: {x: 0.09509891, y: 1.1254551, z: 0.1453805}
|
||||
--- !u!114 &4138683085727570685
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -43,7 +43,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
/// 布尔值变化时触发的事件
|
||||
/// </summary>
|
||||
public event System.Action<bool> OnActivationChanged;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 定时器运行状态
|
||||
/// </summary>
|
||||
|
@ -158,6 +158,10 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
/// 判断物体是否在相机里面
|
||||
/// </summary>
|
||||
public bool ispcamera;
|
||||
/// <summary>
|
||||
/// 激光武器攻击时间
|
||||
/// </summary>
|
||||
public static float timer;
|
||||
void Start()
|
||||
{
|
||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||
|
@ -183,10 +187,10 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
OuterLaserlineRenderer.SetPosition(0, LaserPoint.transform.position);// 设置线段起点为物体位置
|
||||
OuterLaserlineRenderer.SetPosition(1, LaserPoint.transform.position);// 设置线段终点为目标点
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
lasertime -= Time.deltaTime;
|
||||
|
@ -197,7 +201,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LateUpdate()
|
||||
{
|
||||
if (Receivingdistance > 0 && isplaser == true)
|
||||
|
@ -225,6 +229,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
StorageIntervalTime = weaponitemone[i].para_value;
|
||||
lasertime = float.Parse(StorageIntervalTime);
|
||||
storageIntervalTime = float.Parse(StorageIntervalTime);
|
||||
timer = storageIntervalTime;
|
||||
break;
|
||||
case "毁伤目标累积作用时间:":
|
||||
CumulativeActionTimeOfDamageTarget = weaponitemone[i].para_value;
|
||||
|
@ -234,7 +239,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
|
||||
Receivingdistance = float.Parse(InterferenceDistance) * 1000;
|
||||
break;
|
||||
case "干扰角度:":
|
||||
case "瞬时视场:":
|
||||
InterferenceAngle = weaponitemone[i].para_value;
|
||||
break;
|
||||
default:
|
||||
|
@ -243,7 +248,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 看向无人机
|
||||
|
@ -262,7 +267,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
Debug.LogError("没有目标");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 激光显示
|
||||
/// </summary>
|
||||
|
@ -271,11 +276,11 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
if (targetPoint != null && Receivingdistance > 0)
|
||||
{
|
||||
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);
|
||||
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;
|
||||
float angle = Vector3.Angle(cector, transform.forward);
|
||||
if (float.Parse(InterferenceAngle) > angle)
|
||||
|
@ -448,7 +453,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
StartCoroutine(LaserExtinction());
|
||||
});
|
||||
}
|
||||
void OnMouseDown()
|
||||
void OnMouseDown()
|
||||
{
|
||||
|
||||
//Transform canvas = GameObject.Find("Canvas").transform;
|
||||
|
|
|
@ -194,7 +194,7 @@ public class RadarManger : MonoBehaviour
|
|||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region 启动暂停
|
||||
|
@ -222,9 +222,15 @@ public class RadarManger : MonoBehaviour
|
|||
while (true)
|
||||
{
|
||||
//Debug.Log("Timer fired at: " + Time.time);
|
||||
yield return new WaitForSeconds(5); // 等待一段时间后继续执行
|
||||
RetrievalUAV();
|
||||
|
||||
|
||||
if (LaserFireControlPlatformManger.timer>0)
|
||||
{
|
||||
yield return new WaitForSeconds(LaserFireControlPlatformManger.timer); // 等待一段时间后继续执行
|
||||
RetrievalUAV();
|
||||
}
|
||||
//Deadzone();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +313,7 @@ public class RadarManger : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 雷达转动速度
|
||||
|
@ -335,26 +341,29 @@ public class RadarManger : MonoBehaviour
|
|||
{
|
||||
for (int i = 0; i < targets.Count; i++)
|
||||
{
|
||||
UnmannedAerialVehicle unmannedAerialVehicle = targets[i].GetComponent<UnmannedAerialVehicle>();
|
||||
if (unmannedAerialVehicle)
|
||||
if (targets != null)
|
||||
{
|
||||
bool isnearBlindArea = Vector3.Distance(transform.position, unmannedAerialVehicle.transform.position) > nearBlindArea;
|
||||
if (!isnearBlindArea)
|
||||
continue;
|
||||
LaserFireControlPlatformManger laserFireControlPlatformManger = LaserFireControlPlatformManger.laserFireControlPlatformMangers.Find(x => (x != null && x.isLasing == false && x.lasertime <= 0));
|
||||
Microwaveweapon microwaveweapon = Microwaveweapon.MicrowaveweaponList.Find(x => x != null && x.ismicow == false);
|
||||
if (laserFireControlPlatformManger)
|
||||
UnmannedAerialVehicle unmannedAerialVehicle = targets[i].transform.Find("无人机").GetComponent<UnmannedAerialVehicle>();
|
||||
if (unmannedAerialVehicle)
|
||||
{
|
||||
laserFireControlPlatformManger.lasertime = laserFireControlPlatformManger.storageIntervalTime + 1.5f;
|
||||
laserFireControlPlatformManger.isLasing = true;
|
||||
laserFireControlPlatformManger.targetPoint = unmannedAerialVehicle.transform;
|
||||
laserFireControlPlatformManger.Lasing();
|
||||
}
|
||||
else if (microwaveweapon)
|
||||
{
|
||||
microwaveweapon.ismicow = true;
|
||||
microwaveweapon.miceopos = unmannedAerialVehicle.transform;
|
||||
microwaveweapon.Orientation();
|
||||
bool isnearBlindArea = Vector3.Distance(transform.position, unmannedAerialVehicle.transform.position) > nearBlindArea;
|
||||
if (!isnearBlindArea)
|
||||
continue;
|
||||
LaserFireControlPlatformManger laserFireControlPlatformManger = LaserFireControlPlatformManger.laserFireControlPlatformMangers.Find(x => (x != null && x.isLasing == false && x.lasertime <= 0));
|
||||
Microwaveweapon microwaveweapon = Microwaveweapon.MicrowaveweaponList.Find(x => x != null && x.ismicow == false);
|
||||
if (laserFireControlPlatformManger)
|
||||
{
|
||||
laserFireControlPlatformManger.lasertime = laserFireControlPlatformManger.storageIntervalTime + 1.5f;
|
||||
laserFireControlPlatformManger.isLasing = true;
|
||||
laserFireControlPlatformManger.targetPoint = unmannedAerialVehicle.transform;
|
||||
laserFireControlPlatformManger.Lasing();
|
||||
}
|
||||
else if (microwaveweapon)
|
||||
{
|
||||
microwaveweapon.ismicow = true;
|
||||
microwaveweapon.miceopos = unmannedAerialVehicle.transform;
|
||||
microwaveweapon.Orientation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -478,14 +487,14 @@ public class RadarManger : MonoBehaviour
|
|||
/// </summary>
|
||||
public bool GetQualifiedEquipment(GameObject obj)
|
||||
{
|
||||
if(obj.GetComponent<UnmannedAerialVehicleManage>()
|
||||
if (obj.GetComponent<UnmannedAerialVehicleManage>()
|
||||
&& 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;
|
||||
else
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检测鼠标点击的方法
|
||||
|
|
Loading…
Reference in New Issue