Ejemplo n.º 1
0
 public static NavigationPath Combine(NavigationPath a, NavigationPath b)
 {
     Vector3[] points = new Vector3[a.Points.Length + b.Points.Length - 1];
      for (var i = 0; i < a.Points.Length; i++) {
     points[i] = a.Points[i];
      }
      for (var i = 1; i < b.Points.Length; i++) {
     points[a.Points.Length + i - 1] = b.Points[i];
      }
      return new NavigationPath(points);
 }
Ejemplo n.º 2
0
 private List<NavigationPath> GetConnectorToConnectorPathlets(Vector3 startPosition, Vector3 endPosition, int currentGridletIndex, NavigationGridlet[] gridletPath)
 {
     var currentGridlet = gridletPath[currentGridletIndex];
      var destinationGridlet = gridletPath[currentGridletIndex + 1];
      var edges = currentGridlet.EdgeCells.Where(c => c.Neighbors.Any(n => n.Gridlet == destinationGridlet)).ToArray();
      var currentObb = currentGridlet.OrientedBoundingBox;
      var result = new List<NavigationPath>();
      foreach (var connectingEdge in edges) {
     var neighbors = connectingEdge.Neighbors.Where(n => n.Gridlet == destinationGridlet).ToArray();
     foreach (var neighbor in neighbors) {
        var neighborObb = neighbor.OrientedBoundingBox;
        var pathlet = new NavigationPath(new[] { startPosition, neighborObb.Center });
        result.Add(pathlet);
     }
      }
      return result;
 }