|
|
|
@ -64,7 +64,7 @@ public class LocationSimulator : MonoBehaviour
|
|
|
|
|
postData.Add(i.ToString(), json); |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
HttpManager.Instance.Post (url, postData); |
|
|
|
|
HttpManager.Instance.Post(url, postData); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -77,7 +77,7 @@ public class LocationSimulator : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
if (isOn) |
|
|
|
|
{ |
|
|
|
|
LoadTrackData(targetNo, data => |
|
|
|
|
LoadTrackData(targetNo, data => |
|
|
|
|
{ |
|
|
|
|
trackLocationData = data; |
|
|
|
|
if (trackLocationData.Count > 0) |
|
|
|
@ -96,10 +96,10 @@ public class LocationSimulator : MonoBehaviour
|
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="targetNo"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private void LoadTrackData(long targetNo,Action<List<LocationData>> action) |
|
|
|
|
private void LoadTrackData(long targetNo, Action<List<LocationData>> action) |
|
|
|
|
{ |
|
|
|
|
var url = HttpManager.Instance.GetPersonnelHistoryData; |
|
|
|
|
HttpManager.Instance.Get<List<PositionData>>(url, tempData => |
|
|
|
|
HttpManager.Instance.Get<List<PositionData>>(url, tempData => |
|
|
|
|
{ |
|
|
|
|
var loadedData = new List<LocationData>(); |
|
|
|
|
foreach (var item in tempData) |
|
|
|
@ -199,7 +199,7 @@ public class LocationSimulator : MonoBehaviour
|
|
|
|
|
{ |
|
|
|
|
while (true) |
|
|
|
|
{ |
|
|
|
|
var url = $"{Config.LocationServer}/le/uwbofferdata/getPositionDataByMapId/12"; |
|
|
|
|
var url = $"{Config.LocationServer}/le/uwbofferdata/getPositionDataByMapId/{Config.MapId}"; |
|
|
|
|
HttpManager.Instance.Get<PositionData>(url, tempData => |
|
|
|
|
{ |
|
|
|
|
if (tempData.errorCode != 1) |
|
|
|
@ -221,7 +221,9 @@ public class LocationSimulator : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
if (agentControllers.ContainsKey(data.targetNo)) |
|
|
|
|
{ |
|
|
|
|
agentControllers[data.targetNo].UpdatePosition(data); |
|
|
|
|
//agentControllers[data.targetNo].UpdatePosition(data); |
|
|
|
|
agentControllers[data.targetNo].enabled = false; |
|
|
|
|
agentControllers[data.targetNo].transform.position = Main.LocationSimulator.ConversionTransform(data); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -247,7 +249,7 @@ public class LocationSimulator : MonoBehaviour
|
|
|
|
|
yield return new WaitForSeconds(Config.Interval); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 确保角色始终在地面上 |
|
|
|
@ -273,7 +275,7 @@ public class LocationSimulator : MonoBehaviour
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
private AgentController CreateAgent(LocationData data) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (characterCount > 4) |
|
|
|
|
characterCount = 0; |
|
|
|
|
var obj = Instantiate(AssetManager.Instance.characters[characterCount]) as GameObject; |
|
|
|
@ -286,7 +288,7 @@ public class LocationSimulator : MonoBehaviour
|
|
|
|
|
controller.targetNo = data.targetNo; |
|
|
|
|
controller.ShowStatus(data.createdTime, data.targetNo); |
|
|
|
|
controller.SetToNvMesh(pos); |
|
|
|
|
SetActive(obj,data); |
|
|
|
|
SetActive(obj, data); |
|
|
|
|
characterCount++; |
|
|
|
|
return controller; |
|
|
|
|
|
|
|
|
@ -312,7 +314,7 @@ public class LocationSimulator : MonoBehaviour
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
public Vector3 ConversionTransform(LocationData data) |
|
|
|
|
{ |
|
|
|
|
var pos = new Vector3(-((float)data.xAxis+offsetX), -17.7f, -((float)data.yAxis+offsetZ)); |
|
|
|
|
var pos = new Vector3(-((float)data.xAxis - offsetX), -17.7f, -((float)data.yAxis - offsetZ)); |
|
|
|
|
//pos.y = SetY(pos); |
|
|
|
|
|
|
|
|
|
return pos; |
|
|
|
|