Compare commits
No commits in common. "30f13a8e8e605b059166ad26f81af4781821b2e6" and "e2fcd7b6a75bd6d200d895497bd29991021e357b" have entirely different histories.
30f13a8e8e
...
e2fcd7b6a7
|
@ -403,7 +403,7 @@ Camera:
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 7326748669528570608}
|
m_GameObject: {fileID: 7326748669528570608}
|
||||||
m_Enabled: 0
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_ClearFlags: 1
|
m_ClearFlags: 1
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||||
|
|
|
@ -65,13 +65,13 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
/// 检测范围半径
|
/// 检测范围半径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float detectionRadius = 50; //
|
public float detectionRadius = 50; //
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 爆炸预制体
|
/// 爆炸预制体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameObject explodePrefab;
|
public GameObject explodePrefab;
|
||||||
|
|
||||||
public Transform attackTarget;
|
|
||||||
private void OnTriggerEnter(Collider other)
|
private void OnTriggerEnter(Collider other)
|
||||||
{
|
{
|
||||||
if (unmannedAerialVehicleManage.equipmentCommon.isPlayer && other.tag == "AttackTarget")
|
if (unmannedAerialVehicleManage.equipmentCommon.isPlayer && other.tag == "AttackTarget")
|
||||||
|
@ -84,9 +84,9 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置无人机类型
|
/// 设置无人机类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wrjModel"></param>
|
/// <param name="wrjModel"></param>
|
||||||
public void SetWRJModel(WRJModel _wrjModel)
|
public void SetWRJModel(WRJModel _wrjModel)
|
||||||
{
|
{
|
||||||
wrjModel = _wrjModel;
|
wrjModel = _wrjModel;
|
||||||
|
@ -132,7 +132,7 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddBao(bool isPassMessage)
|
public void AddBao(bool isPassMessage)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isPassMessage)
|
if (isPassMessage)
|
||||||
{
|
{
|
||||||
string nowData = GetSyncDis();
|
string nowData = GetSyncDis();
|
||||||
|
@ -140,7 +140,7 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
//_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
//_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||||
DeviceManager.Instance.send2roomStr.Enqueue(nowData);
|
DeviceManager.Instance.send2roomStr.Enqueue(nowData);
|
||||||
string currentTime = System.DateTime.Now.ToString();
|
string currentTime = System.DateTime.Now.ToString();
|
||||||
string _log = currentTime + " " + unmannedAerialVehicleManage.equipmentCommon.equipmentType + "(" + unmannedAerialVehicleManage.equipmentCommon.deviceID + ")"
|
string _log= currentTime + " " + unmannedAerialVehicleManage.equipmentCommon.equipmentType + "(" + unmannedAerialVehicleManage.equipmentCommon.deviceID + ")"
|
||||||
+ "编号" + serialNumber + "子无人机" + "自杀式攻击自爆了";
|
+ "编号" + serialNumber + "子无人机" + "自杀式攻击自爆了";
|
||||||
UploadLog(_log);
|
UploadLog(_log);
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
Bao.transform.localPosition = Vector3.zero;
|
Bao.transform.localPosition = Vector3.zero;
|
||||||
Bao.transform.SetParent(null);
|
Bao.transform.SetParent(null);
|
||||||
Bao.SetActive(true);
|
Bao.SetActive(true);
|
||||||
|
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,20 +158,19 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
/// <param name="deviceID"></param>
|
/// <param name="deviceID"></param>
|
||||||
public void UploadLog(string _log)
|
public void UploadLog(string _log)
|
||||||
{
|
{
|
||||||
|
|
||||||
List<UploadLogMain> uploadLogMains = new List<UploadLogMain>();
|
List<UploadLogMain> uploadLogMains = new List<UploadLogMain>();
|
||||||
UploadLogMain uploadLogMain = new UploadLogMain();
|
UploadLogMain uploadLogMain = new UploadLogMain();
|
||||||
uploadLogMain.PracticeId = GlobalFlag.practiceSubjectID;
|
uploadLogMain.PracticeId = GlobalFlag.practiceSubjectID;
|
||||||
uploadLogMain.ThinkId = GlobalFlag.currentThinkId;
|
uploadLogMain.ThinkId = GlobalFlag.currentThinkId;
|
||||||
string log =
|
string log =
|
||||||
uploadLogMain.log = _log;
|
uploadLogMain.log = _log;
|
||||||
uploadLogMains.Add(uploadLogMain);
|
uploadLogMains.Add(uploadLogMain);
|
||||||
string uploadLogMainJson = JsonConvert.SerializeObject(uploadLogMains);
|
string uploadLogMainJson = JsonConvert.SerializeObject(uploadLogMains);
|
||||||
WWWForm wWWForm = new WWWForm();
|
WWWForm wWWForm = new WWWForm();
|
||||||
wWWForm.AddField("data", uploadLogMainJson);
|
wWWForm.AddField("data", uploadLogMainJson);
|
||||||
Debug.Log(uploadLogMainJson);
|
Debug.Log(uploadLogMainJson);
|
||||||
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data =>
|
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data => {
|
||||||
{
|
|
||||||
Debug.Log(data);
|
Debug.Log(data);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -188,15 +187,14 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||||
string currentTime = System.DateTime.Now.ToString();
|
string currentTime = System.DateTime.Now.ToString();
|
||||||
string _log = currentTime + " " + unmannedAerialVehicleManage.equipmentCommon.equipmentType + "(" + unmannedAerialVehicleManage.equipmentCommon.deviceID + ")"
|
string _log = currentTime + " " + unmannedAerialVehicleManage.equipmentCommon.equipmentType + "(" + unmannedAerialVehicleManage.equipmentCommon.deviceID + ")"
|
||||||
+ "编号" + serialNumber + "子无人机" + "攻击摧毁了" + _equipmentCommon.equipmentType + "(" + _equipmentCommon.deviceID + ")";
|
+ "编号" + serialNumber + "子无人机" + "攻击摧毁了"+ _equipmentCommon.equipmentType + "(" + _equipmentCommon.deviceID + ")";
|
||||||
UploadLog(_log);
|
UploadLog(_log);
|
||||||
|
|
||||||
WWWForm headers = new WWWForm();
|
WWWForm headers = new WWWForm();
|
||||||
headers.AddField("id", _equipmentCommon.deviceID);
|
headers.AddField("id", _equipmentCommon.deviceID);
|
||||||
StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data =>
|
//StartCoroutine(PostString(Url_Deletepracticedevicedetail, headers, data => {
|
||||||
{
|
// //Debug.Log(data);
|
||||||
//Debug.Log(data);
|
//}));
|
||||||
}));
|
|
||||||
GameObject Bao = Instantiate(explodePrefab, _transform);
|
GameObject Bao = Instantiate(explodePrefab, _transform);
|
||||||
Bao.transform.localPosition = Vector3.zero;
|
Bao.transform.localPosition = Vector3.zero;
|
||||||
Bao.transform.SetParent(null);
|
Bao.transform.SetParent(null);
|
||||||
|
@ -220,24 +218,20 @@ public class UnmannedAerialVehicle : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AttAck(Transform target)
|
public void AttAck(Transform target)
|
||||||
{
|
{
|
||||||
if (attackTarget == null)
|
Debug.Log("开始攻击目标..:" + target.name);
|
||||||
|
Vector3 _v3 = target.position;
|
||||||
|
|
||||||
|
transform.DOLookAt(_v3, 0.1f).OnComplete(() =>
|
||||||
{
|
{
|
||||||
transform.DOKill();
|
float distance = Vector3.Distance(transform.position, target.position);
|
||||||
attackTarget = target;
|
transform.DOMove(target.position, distance / FireSpeed).SetEase(Ease.Linear).OnComplete(() =>
|
||||||
Debug.Log("开始攻击目标..:" + target.name);
|
|
||||||
Vector3 _v3 = target.position;
|
|
||||||
transform.DOLookAt(_v3, 0.1f).OnComplete(() =>
|
|
||||||
{
|
{
|
||||||
float distance = Vector3.Distance(transform.position, target.position);
|
if (!target)
|
||||||
transform.DOMove(target.position, distance / FireSpeed).SetEase(Ease.Linear).OnComplete(() =>
|
|
||||||
{
|
{
|
||||||
if (!target)
|
BeAssaulted("没有攻击到目标");
|
||||||
{
|
}
|
||||||
BeAssaulted("没有攻击到目标");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -275,7 +275,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SelectiveAttackDrone()
|
private void SelectiveAttackDrone()
|
||||||
{
|
{
|
||||||
//if (isEngagedTarget) return;
|
if (isEngagedTarget) return;
|
||||||
if (wrjModel == WRJModel.电子侦察无人机 || wrjModel == WRJModel.光学无人机)
|
if (wrjModel == WRJModel.电子侦察无人机 || wrjModel == WRJModel.光学无人机)
|
||||||
{
|
{
|
||||||
List<Collider> colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体
|
List<Collider> colliders = Physics.OverlapSphere(transform.position, detectionRadius).ToList(); // 检索范围内的所有碰撞体
|
||||||
|
@ -290,7 +290,7 @@ public class UnmannedAerialVehicleManage : MonoBehaviour
|
||||||
{
|
{
|
||||||
if (attackColliders1.Count > 0)
|
if (attackColliders1.Count > 0)
|
||||||
{
|
{
|
||||||
//isEngagedTarget = true;
|
isEngagedTarget = true;
|
||||||
//colliders1.ForEach(x => Debug.Log(x.transform.name));
|
//colliders1.ForEach(x => Debug.Log(x.transform.name));
|
||||||
int _number = UnityEngine.Random.Range(0, attackColliders1.Count - 1);
|
int _number = UnityEngine.Random.Range(0, attackColliders1.Count - 1);
|
||||||
List<UnmannedAerialVehicle> _unmannedAerialVehicles = unmannedAerialVehicles.FindAll(x => x != null && x.gameObject.activeSelf);
|
List<UnmannedAerialVehicle> _unmannedAerialVehicles = unmannedAerialVehicles.FindAll(x => x != null && x.gameObject.activeSelf);
|
||||||
|
|
Loading…
Reference in New Issue