This commit is contained in:
parent
38fbae20bf
commit
494cb4b9a7
|
@ -116,29 +116,31 @@ public class DeviceManager : MonoSingleton<DeviceManager>
|
|||
return tempUAM;
|
||||
}
|
||||
|
||||
public List<UnmannedAerialVehicleManage> unmannedAerialVehicleManages;
|
||||
public void SetCollider4WRJ(List<Collider> attackColliders, ref Collider currentTarget)
|
||||
{
|
||||
if (attackColliders.Count > 0)
|
||||
{
|
||||
List<UnmannedAerialVehicleManage> temp = GetGXWRJAndZSWRJ();
|
||||
for (int i = 0; i < temp.Count; i++)
|
||||
unmannedAerialVehicleManages = GetGXWRJAndZSWRJ();
|
||||
for (int i = 0; i < unmannedAerialVehicleManages.Count; i++)
|
||||
{
|
||||
if (temp[i].unmannedAerialVehicles[0] != null && temp[i].unmannedAerialVehicles[0].gameObject.activeSelf)
|
||||
if (unmannedAerialVehicleManages[i].unmannedAerialVehicles[0] != null && unmannedAerialVehicleManages[i].unmannedAerialVehicles[0].gameObject.activeSelf)
|
||||
{
|
||||
if (temp[i].unmannedAerialVehicles[0].attackTarget == null)
|
||||
if (unmannedAerialVehicleManages[i].unmannedAerialVehicles[0].attackTarget == null)
|
||||
{
|
||||
for (int j = 0; j < attackColliders.Count; j++)
|
||||
{
|
||||
Collider c = null;
|
||||
if (attackColliders[i] != null)
|
||||
{
|
||||
c = attackColliders[i];
|
||||
}
|
||||
if (attackColliders[j] != null)
|
||||
{
|
||||
temp[i].unmannedAerialVehicles[0].AttAck(attackColliders[j].transform);
|
||||
}
|
||||
}
|
||||
unmannedAerialVehicleManages[i].unmannedAerialVehicles[0].AttAck(attackColliders[0].transform);
|
||||
//for (int j = 0; j < attackColliders.Count; j++)
|
||||
//{
|
||||
// Collider c = null;
|
||||
// if (attackColliders[i] != null)
|
||||
// {
|
||||
// c = attackColliders[i];
|
||||
// }
|
||||
// if (attackColliders[j] != null)
|
||||
// {
|
||||
// unmannedAerialVehicleManages[i].unmannedAerialVehicles[0].AttAck(attackColliders[j].transform);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +170,7 @@ public class DeviceManager : MonoSingleton<DeviceManager>
|
|||
if(highPriorityTarget)
|
||||
{
|
||||
Vector3 Pos=new Vector3(float.Parse(info[3]), float.Parse(info[4]), float.Parse(info[5]));
|
||||
highPriorityTarget.BeAssaulted(Pos, false);
|
||||
highPriorityTarget.BeAssaulted(Pos, false, int.Parse(info[2]));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -68,10 +68,6 @@ public class HighPriorityTarget : MonoBehaviour
|
|||
if (isSend)
|
||||
{
|
||||
HP -= 10;
|
||||
GameObject Bao = Instantiate(explodePrefab, transform);
|
||||
Bao.transform.localPosition = Pos;
|
||||
Bao.transform.SetParent(null);
|
||||
Bao.SetActive(true);
|
||||
string nowData = GetSyncDis(Pos);
|
||||
Debug.Log(nowData);
|
||||
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||
|
@ -80,6 +76,10 @@ public class HighPriorityTarget : MonoBehaviour
|
|||
{
|
||||
HP = hp;
|
||||
}
|
||||
GameObject Bao = Instantiate(explodePrefab, transform);
|
||||
Bao.transform.localPosition = Pos;
|
||||
Bao.transform.SetParent(null);
|
||||
Bao.SetActive(true);
|
||||
if (HP < 50)
|
||||
{
|
||||
ModerFull.SetActive(false);
|
||||
|
|
|
@ -72,7 +72,9 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
|||
public GameObject explodePrefab;
|
||||
|
||||
public TextMesh tips;
|
||||
|
||||
/// <summary>
|
||||
/// 攻击目标
|
||||
/// </summary>
|
||||
public Transform attackTarget;
|
||||
|
||||
/// <summary>
|
||||
|
@ -129,6 +131,44 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
|||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁蓝方设备
|
||||
/// </summary>
|
||||
/// <param name="_transform"></param>
|
||||
void AddBao(Transform _transform)
|
||||
{
|
||||
//设备
|
||||
EquipmentCommon _equipmentCommon = _transform.GetComponent<EquipmentCommon>();
|
||||
if (_equipmentCommon)
|
||||
{
|
||||
string nowData = string.Format("{0},{1}", "SetToBeDestroyed", _equipmentCommon.deviceID);
|
||||
//Debug.Log(nowData);
|
||||
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||
string currentTime = System.DateTime.Now.ToString();
|
||||
string _log = currentTime + " " + unmannedAerialVehicleManage.equipmentCommon.equipmentType + "(" + unmannedAerialVehicleManage.equipmentCommon.deviceID + ")"
|
||||
+ "编号" + serialNumber + "子无人机" + "攻击摧毁了" + _equipmentCommon.equipmentType + "(" + _equipmentCommon.deviceID + ")";
|
||||
UploadLog(_log);
|
||||
|
||||
WWWForm headers = new WWWForm();
|
||||
headers.AddField("id", _equipmentCommon.deviceID);
|
||||
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data =>
|
||||
{
|
||||
//Debug.Log(data);
|
||||
}));
|
||||
}
|
||||
//重点打击目标
|
||||
HighPriorityTarget highPriorityTarget = _transform.GetComponent<HighPriorityTarget>();
|
||||
if (highPriorityTarget )
|
||||
{
|
||||
highPriorityTarget.BeAssaulted(transform.position, true);
|
||||
}
|
||||
|
||||
GameObject Bao = Instantiate(explodePrefab, _transform);
|
||||
Bao.transform.localPosition = Vector3.zero;
|
||||
Bao.transform.SetParent(null);
|
||||
Bao.SetActive(true);
|
||||
Destroy(_transform.gameObject);
|
||||
}
|
||||
/// <summary>
|
||||
///上传日志
|
||||
/// </summary>
|
||||
|
@ -153,33 +193,7 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
|||
}));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁蓝方设备
|
||||
/// </summary>
|
||||
/// <param name="_transform"></param>
|
||||
void AddBao(Transform _transform)
|
||||
{
|
||||
EquipmentCommon _equipmentCommon = _transform.GetComponent<EquipmentCommon>();
|
||||
string nowData = string.Format("{0},{1}", "SetToBeDestroyed", _equipmentCommon.deviceID);
|
||||
//Debug.Log(nowData);
|
||||
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||
string currentTime = System.DateTime.Now.ToString();
|
||||
string _log = currentTime + " " + unmannedAerialVehicleManage.equipmentCommon.equipmentType + "(" + unmannedAerialVehicleManage.equipmentCommon.deviceID + ")"
|
||||
+ "编号" + serialNumber + "子无人机" + "攻击摧毁了" + _equipmentCommon.equipmentType + "(" + _equipmentCommon.deviceID + ")";
|
||||
UploadLog(_log);
|
||||
|
||||
WWWForm headers = new WWWForm();
|
||||
headers.AddField("id", _equipmentCommon.deviceID);
|
||||
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data =>
|
||||
{
|
||||
//Debug.Log(data);
|
||||
}));
|
||||
GameObject Bao = Instantiate(explodePrefab, _transform);
|
||||
Bao.transform.localPosition = Vector3.zero;
|
||||
Bao.transform.SetParent(null);
|
||||
Bao.SetActive(true);
|
||||
Destroy(_transform.gameObject);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnBecameInvisible()
|
||||
|
@ -210,8 +224,8 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
|||
if (wrjModel == WRJModel.光学无人机)
|
||||
{
|
||||
Debug.Log("光学无人机攻击");
|
||||
//StopCoroutine(RangedAttack());
|
||||
//StartCoroutine(RangedAttack());
|
||||
StopCoroutine(RangedAttack());
|
||||
StartCoroutine(RangedAttack());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -235,7 +249,7 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
|||
{
|
||||
while (attackTarget)
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
yield return new WaitForSeconds(5f);
|
||||
GameObject obj = Instantiate(bulletPrefab, bulletPoint.position, bulletPoint.rotation);
|
||||
obj.SetActive(true);
|
||||
Rigidbody rb = obj.GetComponent<Rigidbody>();
|
||||
|
|
Loading…
Reference in New Issue