///// <summary> ///// 历史轨迹集合 ///// </summary> //public List<LocationHistoryPath> historyPaths; /// <summary> /// 获取取定位卡历史位置信息 /// </summary> /// <returns></returns> public LocationHistoryPath ShowLocationHistoryPath(PathInfo pathInfo, string name = "HistoryPathObj") { //GameObject o = CreateCharacter(); GameObject o = CreatePersonObject(pathInfo.personnelT); LocationHistoryPath path = o.AddComponent <LocationHistoryPath>(); o.name = pathInfo.personnelT.Name + "(" + pathInfo.personnelT.Tag.Code + ")"; path.Init(pathInfo); o.SetActive(true); SetNavAgent(path); return(path); }
/// <summary> /// 添加历史轨迹路线 /// </summary> public void AddHistoryPath(LocationHistoryPath path) { PathList.Add(path); }
/// <summary> /// 显示某个标签的历史数据 /// </summary> /// <param name="code"></param> public void ShowHistoryData() { if (isLoadDataSuccessed) { return; } //LocationManager.Instance.ClearHistoryPaths(); //string code = "0002"; List <Vector3> list = new List <Vector3>(); List <DateTime> timelist = new List <DateTime>(); var posInfoList = new PositionInfoList(); DateTime end = GetEndTime(); DateTime start = GetStartTime(); //List<Position> positions = new List<Position>(); positions = new List <Position>(); List <int> topoNodeIds = RoomFactory.Instance.GetCurrentDepNodeChildNodeIds(SceneEvents.DepNode); Loom.StartSingleThread(() => { //ps = CommunicationObject.Instance.GetHistoryPositonsByTime(code, start, end); positions = GetHistoryData(personnel.Id, topoNodeIds, start, end); Loom.DispatchToMainThread(() => { Debug.LogError("点数:" + positions.Count); if (positions.Count < 2) { return; } for (int i = 0; i < positions.Count; i++) { var p = new PositionInfo(positions[i], start); posInfoList.Add(p); } PathInfo pathInfo = new PathInfo(); pathInfo.personnelT = personnel; pathInfo.color = Color.green; pathInfo.posList = posInfoList; pathInfo.timeLength = timeLength; LocationHistoryPath histoyObj = LocationHistoryManager.Instance.ShowLocationHistoryPath(pathInfo, "HistoryPath0002"); HistoryManController historyManController = histoyObj.gameObject.AddComponent <HistoryManController>(); histoyObj.historyManController = historyManController; historyManController.Init(Color.green, histoyObj); PersonAnimationController personAnimationController = histoyObj.gameObject.GetComponent <PersonAnimationController>(); personAnimationController.DoMove(); PathFindingManager.Instance.StartNavAgent(historyManController); isLoadDataSuccessed = true; timeStart = Time.time; timeSum = 0; //histoyObj.InitData(timeLength, timelist); }); }); }
/// <summary> /// 添加历史轨迹路线 /// </summary> public void Add(LocationHistoryPath path) { ItemsOld.Add(path); }