Esempio n. 1
0
    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);
    }
Esempio n. 2
0
 public PathfindingLayer(PathingTypes name, LayerMask collisionMask)
 {
     this.name          = name;
     this.collisionMask = collisionMask;
 }