Exemple #1
0
    override public void InitGrid()
    {
        //We cast the grid and grid values here for convenience.
        //Casting like this clones the grid. Thus neighbor relations are
        //not preserved (this is a design flaw as of Grids 1.8, to be fixed
        //in a future version). For now it means the actual pathfinding call
        //must use the original grid.
        walkableGrid = (PointyHexGrid <WalkableCell>)Grid.CastValues <WalkableCell, PointyHexPoint>();

        foreach (var point in walkableGrid)
        {
            walkableGrid[point].IsWalkable = true;
        }

        start = walkableGrid.First();
        goal  = walkableGrid.Last();

        UpdatePath();
    }