This commit is contained in:
parent
f6f47e348d
commit
d208b87aad
|
@ -50,7 +50,15 @@ public class Microwaveweapon : MonoBehaviour
|
||||||
if (_isStartRehearsing != value)
|
if (_isStartRehearsing != value)
|
||||||
{
|
{
|
||||||
_isStartRehearsing = value;
|
_isStartRehearsing = value;
|
||||||
OnActivationChanged?.Invoke(_isStartRehearsing);
|
|
||||||
|
GameObject[] wrj = GameObject.FindGameObjectsWithTag("WRJ");
|
||||||
|
for (int i = 0; i < wrj.Length; i++)
|
||||||
|
{
|
||||||
|
UnmannedAerialVehicleManage temp = wrj[i].GetComponent<UnmannedAerialVehicleManage>();
|
||||||
|
temp.limitHealth = float.Parse(Microwavedamagetime);
|
||||||
|
}
|
||||||
|
|
||||||
|
//OnActivationChanged?.Invoke(_isStartRehearsing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +199,17 @@ public class Microwaveweapon : MonoBehaviour
|
||||||
}
|
}
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
if (isStartRehearsing)
|
||||||
|
{
|
||||||
|
microwtimer -= Time.deltaTime;
|
||||||
|
if (microwtimer <= 0)
|
||||||
|
{
|
||||||
|
if (ismicow)
|
||||||
|
{
|
||||||
|
SelectWRJ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 微波武器朝向无人机
|
/// 微波武器朝向无人机
|
||||||
|
@ -201,9 +219,55 @@ public class Microwaveweapon : MonoBehaviour
|
||||||
if (miceopos != null)
|
if (miceopos != null)
|
||||||
{
|
{
|
||||||
microwavepoint.transform.DOLookAt(miceopos.position, 0.1f).SetEase(Ease.Linear);
|
microwavepoint.transform.DOLookAt(miceopos.position, 0.1f).SetEase(Ease.Linear);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public List<UnmannedAerialVehicleManage> wrjList = new List<UnmannedAerialVehicleManage>();
|
||||||
|
/// <summary>
|
||||||
|
/// 检索无人机是否符合角度 距离
|
||||||
|
/// </summary>
|
||||||
|
private void SelectWRJ()
|
||||||
|
{
|
||||||
|
GameObject[] wrj = GameObject.FindGameObjectsWithTag("WRJ");
|
||||||
|
foreach (var item in wrj)
|
||||||
|
{
|
||||||
|
float distance = Vector3.Distance(transform.position, item.transform.position);
|
||||||
|
float angle = Vector3.Angle(transform.forward, item.transform.position - transform.position);
|
||||||
|
UnmannedAerialVehicleManage temp = item.GetComponent<UnmannedAerialVehicleManage>();
|
||||||
|
if (distance < float.Parse(Microwaveinterferencedistance) * 1000 && angle < float.Parse(MicrowaveinterferenceAngle))
|
||||||
|
{
|
||||||
|
if (!wrjList.Contains(temp))
|
||||||
|
{
|
||||||
|
wrjList.Add(temp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (wrjList.Contains(temp))
|
||||||
|
wrjList.Remove(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (wrjList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in wrjList)
|
||||||
|
{
|
||||||
|
item.limitHealth -= Time.deltaTime;
|
||||||
|
if (item.limitHealth <= 0)
|
||||||
|
{
|
||||||
|
var newdata = Aeroplane(item.unmannedAerialVehicles[0]);
|
||||||
|
MyNetMQClient.instance.Send(newdata);
|
||||||
|
DeviceManager.Instance.RemoveDevice(item.gameObject);
|
||||||
|
Destroy(item.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ismicow = false;
|
||||||
|
microwtimer = float.Parse(Storageintervaltime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 激光发起攻击
|
/// 激光发起攻击
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -217,8 +281,8 @@ public class Microwaveweapon : MonoBehaviour
|
||||||
MyNetMQClient.instance.Send(newdata);
|
MyNetMQClient.instance.Send(newdata);
|
||||||
//_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", newdata));
|
//_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", newdata));
|
||||||
//MQTTManager.instance.SendData(MQTTManager.instance.Micow, newdata);
|
//MQTTManager.instance.SendData(MQTTManager.instance.Micow, newdata);
|
||||||
microblog.MicrowaveDisplay(Vector3.Distance(miceopos.position, transform.position) / 10 + 1, 0.5f);
|
//microblog.MicrowaveDisplay(Vector3.Distance(miceopos.position, transform.position) / 10 + 1, 0.5f);
|
||||||
Closeattack(miceopos);
|
//Closeattack(miceopos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -169,10 +169,6 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
highPriorityTarget.BeAssaulted(atkPos, true);
|
highPriorityTarget.BeAssaulted(atkPos, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject Bao = Instantiate(explodePrefab1, _transform);
|
|
||||||
Bao.transform.localPosition = Vector3.zero;
|
|
||||||
Bao.transform.SetParent(null);
|
|
||||||
Bao.SetActive(true);
|
|
||||||
if (_equipmentCommon)
|
if (_equipmentCommon)
|
||||||
{
|
{
|
||||||
DeviceManager.Instance.RemoveDevice(_transform.gameObject);
|
DeviceManager.Instance.RemoveDevice(_transform.gameObject);
|
||||||
|
|
|
@ -208,6 +208,8 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
/// 改变频谱探测地图上显示点的大小
|
/// 改变频谱探测地图上显示点的大小
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool boisp = true;
|
public bool boisp = true;
|
||||||
|
|
||||||
|
public float limitHealth = 2f;
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
//gamePos.gameObject.SetActive(false);
|
//gamePos.gameObject.SetActive(false);
|
||||||
|
|
Loading…
Reference in New Issue