public Vector3[] FindPath(PathingTypes layerName, Vector3 from, IEnumerable <Vector3> to) { if (grids.ContainsKey(layerName)) { PathfindingState state = new PathfindingState(grids[layerName]); state.Start(WorldToLocal(from)); Vector2[] result = state.PathToNearest(to.Select(WorldToLocal)); if (result != null) { return(result.Select(input => LocalToWorld(input)).ToArray()); } } return(null); }
public PathfindingLayer(PathingTypes name, LayerMask collisionMask) { this.name = name; this.collisionMask = collisionMask; }