PlacementGrid.RotateLeft C# (CSharp) Method

RotateLeft() public method

public RotateLeft ( ) : void
return void
	public void RotateLeft() {
		PGridCell[] newInternalCells = new PGridCell[width * height];
		for (int i = 0; i < internalCells.Length; i++) {
			// new index is [numCols - 1 - col][row]
			int newRow = (width - 1) - (i % width);
			int newCol = i / width;
			int index = height * newRow + newCol;
			newInternalCells [index] = new PGridCell (newRow, newCol, internalCells[i].Closed);
		}

		internalCells = newInternalCells;
		int newHeight = width;
		width = height;
		height = newHeight;

		rotation = (rotation + 90) % 360;
	}
}