Пример #1
0
        private bool ArePointsConnected(Point firstPoint, Point secondPoint)
        {
            //Build tcodmap
            TCODFov tcodMap = new TCODFov(Width, Height);

            for (int i = 0; i < Width; i++)
            {
                for (int j = 0; j < Height; j++)
                {
                    tcodMap.SetCell(i, j, !baseMap.mapSquares[i, j].BlocksLight, baseMap.mapSquares[i, j].Walkable);
                }
            }

            //Try to walk the path between the 2 staircases
            TCODPathFinding path = new TCODPathFinding(tcodMap, 1.0);

            path.ComputePath(firstPoint.x, firstPoint.y, secondPoint.x, secondPoint.y);

            //Find the first step. We need to load x and y with the origin of the path
            int x = upStaircase.x;
            int y = upStaircase.y;

            bool obstacleHit = false;

            //If there's no routeable path
            if (path.IsPathEmpty())
            {
                obstacleHit = true;
            }

            path.Dispose();
            tcodMap.Dispose();

            return(!obstacleHit);
        }
Пример #2
0
 public void Cleaup()
 {
     pathFindingFOV.Dispose();
     pathFindingCallback.Dispose();
     fov.Dispose();
 }