private void AddCellIfValid(int x, int y, Pathfinder finder, IList <Cell> container) { if (!Cell.IsInMap(x, y) || !finder.matrix.Any(cell => cell.Key == PathingUtils.CoordToCellId(x, y))) { return; } container.Add(finder.matrix[PathingUtils.CoordToCellId(x, y)]); }
private double PointWeight(Point point) { double result = 1; int cellId = PathingUtils.CoordToCellId(point.X, point.Y); int speed = currentMap.Data.Cells[cellId].Speed; if (speed >= 0) { result = result + (5 - speed); } else { result = result + (11 + Math.Abs(speed)); } return(result); }