public void ClearMap() { for (int x = 0; x < TileLayer.Width; x++) { for (int y = 0; y < TileLayer.Height; y++) { if (TileLayer.GetCellMovability(x, y)) { distanceMap[x, y] = float.MaxValue; } else { distanceMap[x, y] = -1.0f; } } } }
// Return true on collision public static bool RayTest(Vector2 startPos, Vector2 endPos) { for (int x = 0; x < TileLayer.Width; x++) { for (int y = 0; y < TileLayer.Height; y++) { if (!TileLayer.GetCellMovability(x, y)) { if (SegmentIntersectRectangle(new Vector2(x, y), new Vector2(x + 1, y + 1), startPos, endPos)) { return(true); } } } } return(false); }