private static Vector3 CreatePosition(CellMatrix cellMatrix, Cell cell) { return(new Vector3( cellMatrix.BottomLeft.x + cell.Coord.X, 0, cellMatrix.BottomLeft.y + cell.Coord.Y )); }
public static IEnumerable <Cell> RadialForEach( this CellMatrix cellMatrix, Cell center, int radio ) { return(RadialForEach(cellMatrix, center.Coord, radio)); }
public static void DrawCell(CellMatrix cellMatrix, Cell cell) { var position = new Vector3( cellMatrix.BottomLeft.x + cell.Coord.X, 0, cellMatrix.BottomLeft.y + cell.Coord.Y ); Gizmos.color = cell.Value == 1 ? Color.black : Color.white; Gizmos.DrawCube(position, Vector3.one); }
public static IEnumerable <Cell> RadialForEach( this CellMatrix cellMatrix, Coord center, int radio) { for (var x = center.X - radio; x <= center.X + radio; x++) { for (var y = center.Y - radio; y <= center.Y + radio; y++) { yield return(cellMatrix[x, y]); } } }
public SquareEdgeNodeMatrix(CellMatrix cellMatrix, float squareSideSize) { nodes = new SquareEdgeNode[cellMatrix.Width, cellMatrix.Height]; cellMatrix.ForEach(cell => AddNode(squareSideSize, cell, CreatePosition(cellMatrix, cell))); }
public CellMatrixRegionResolver(CellMatrix cellMatrix) { this.cellMatrix = cellMatrix; InitializeVisited(cellMatrix); }
private void InitializeVisited(CellMatrix cellMatrix) { visitedCells = new bool[cellMatrix.Width, cellMatrix.Height]; }