This commit is contained in:
parent
271977ab25
commit
ab43740c90
|
@ -262,7 +262,7 @@ public class EquipmentCommon : MonoBehaviour
|
||||||
break;
|
break;
|
||||||
case "SingleDronePosition"://无人机攻击目标锁定
|
case "SingleDronePosition"://无人机攻击目标锁定
|
||||||
UnmannedAerialVehicleManage unmannedAerialVehicleManage = GetComponent<UnmannedAerialVehicleManage>();
|
UnmannedAerialVehicleManage unmannedAerialVehicleManage = GetComponent<UnmannedAerialVehicleManage>();
|
||||||
if (unmannedAerialVehicleManage)
|
if (unmannedAerialVehicleManage&& unmannedAerialVehicleManage.wrjModel== WRJModel.自杀式无人机)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < unmannedAerialVehicleManage.unmannedAerialVehicles.Count; i++)
|
for (int i = 0; i < unmannedAerialVehicleManage.unmannedAerialVehicles.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -230,6 +230,9 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
string nowData = GetSyncData(attackTarget);
|
||||||
|
Debug.Log(nowData);
|
||||||
|
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||||
float distance = Vector3.Distance(transform.position, attackTarget.position);
|
float distance = Vector3.Distance(transform.position, attackTarget.position);
|
||||||
transform.DOMove(attackTarget.position, distance / FireSpeed).SetEase(Ease.Linear).OnComplete(() =>
|
transform.DOMove(attackTarget.position, distance / FireSpeed).SetEase(Ease.Linear).OnComplete(() =>
|
||||||
{
|
{
|
||||||
|
@ -243,6 +246,7 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 远程攻击
|
/// 远程攻击
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -253,8 +257,9 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
yield return new WaitForSeconds(5f);
|
yield return new WaitForSeconds(5f);
|
||||||
GameObject obj = Instantiate(bulletPrefab, bulletPoint.position, bulletPoint.rotation);
|
GameObject obj = Instantiate(bulletPrefab, bulletPoint.position, bulletPoint.rotation);
|
||||||
obj.SetActive(true);
|
obj.SetActive(true);
|
||||||
Rigidbody rb = obj.GetComponent<Rigidbody>();
|
//Rigidbody rb = obj.GetComponent<Rigidbody>();
|
||||||
rb.AddForce(bulletPoint.forward * 20f, ForceMode.Impulse);
|
//rb.AddForce(bulletPoint.forward * 20f, ForceMode.Impulse);
|
||||||
|
obj.transform.DOMove(attackTarget.position, 2).SetEase(Ease.Linear);
|
||||||
ShellBoom sb = obj.AddComponent<ShellBoom>();
|
ShellBoom sb = obj.AddComponent<ShellBoom>();
|
||||||
sb.isPlayer = unmannedAerialVehicleManage.equipmentCommon.isPlayer;
|
sb.isPlayer = unmannedAerialVehicleManage.equipmentCommon.isPlayer;
|
||||||
sb.onShellAttack.AddListener(() =>
|
sb.onShellAttack.AddListener(() =>
|
||||||
|
@ -294,5 +299,14 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
return string.Format("{0},{1},{2}", "DroneWasDestroyed", unmannedAerialVehicleManage.equipmentCommon.deviceID, serialNumber);
|
return string.Format("{0},{1},{2}", "DroneWasDestroyed", unmannedAerialVehicleManage.equipmentCommon.deviceID, serialNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 无人机攻击目标传递
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected string GetSyncData(Transform attackTarget)
|
||||||
|
{
|
||||||
|
return string.Format("{0},{1},{2},{3},{4}", "SingleDronePosition", unmannedAerialVehicleManage.equipmentCommon.deviceID,
|
||||||
|
attackTarget.position.x, attackTarget.position.y, attackTarget.position.z);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,11 +304,11 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
var highPriorityTargets = attackColliders1.FindAll(x => x.transform.GetComponent<HighPriorityTarget>());
|
var highPriorityTargets = attackColliders1.FindAll(x => x.transform.GetComponent<HighPriorityTarget>());
|
||||||
if (highPriorityTargets.Count > 0)
|
if (highPriorityTargets.Count > 0)
|
||||||
{
|
{
|
||||||
SendMsg(highPriorityTargets[0].transform);
|
//SendMsg(highPriorityTargets[0].transform);
|
||||||
unmannedAerialVehicles[0].AttAck(highPriorityTargets[0].transform);
|
unmannedAerialVehicles[0].AttAck(highPriorityTargets[0].transform);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
SendMsg(attackColliders1[0].transform);
|
//SendMsg(attackColliders1[0].transform);
|
||||||
unmannedAerialVehicles[0].AttAck(attackColliders1[0].transform);
|
unmannedAerialVehicles[0].AttAck(attackColliders1[0].transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue