private void LocateAgent() { for (int i = 0; i < number_of_carriges; i++) { currentLength[i] = -i * (Size.X + 2); } if (WayPointsList.Count > 1) { CheckPointsList = new List <WayPoint>(); for (int i = 1; i < WayPointsList.Count; i++) { RoadGraph.ViewedNodes.Clear(); foreach (var node in RoadGraph.GetNodesWay(WayPointsList[i - 1], WayPointsList[i])) { if (CheckPointsList.Count == 0 || !CheckPointsList[CheckPointsList.Count - 1].Equals(node)) { CheckPointsList.Add(node); } } } positions[0] = CheckPointsList[0].LocationPoint; position = CheckPointsList[0].LocationPoint; need_draw[0] = true; CurrentSpeed = MaxSpeed; } }
private void LocateAgent() { if (WayPointsList.Count > 1) { RoadGraph.ViewedNodes.Clear(); CheckPointsList = RoadGraph.GetNodesWay(WayPointsList[0], WayPointsList[WayPointsList.Count - 1]); position = CheckPointsList[0].LocationPoint; CurrentSpeed = MaxSpeed; } }
private void LocateAgent() { if (RouteList.Count > 1 || RoadGraph == null) { RoadGraph.ViewedNodes.Clear(); RouteList = RoadGraph.GetNodesWay(RouteList.First(), RouteList.Last()); Position = RouteList.First().Location; base.CurrentSpeed = base._maxSpeed; _located = true; } else { RouteList.Clear(); } }