PlacementGrid.Cells C# (CSharp) Метод

Cells() публичный Метод

public Cells ( ) : PGridCell[],
Результат PGridCell[],
	public PGridCell[] Cells() {
		return internalCells;
	}

Usage Example

Пример #1
0
	/*
	 * This method calculates the new spots that are no longer available after object placement
	 * Params - obstacleGrid: the PlacementGrid for the obstacle just placed
	 * 			r, c: the row and column the obstacle was placed
	 */
	void CalculateAvailableCells(PlacementGrid obstacleGrid, int r, int c) {
		// Every cell around a closed cell in obstacleGrid is no longer available
		foreach(PGridCell cell in obstacleGrid.Cells()) {
			if (cell.Closed) {
				// remember that there is actually an obstacle at this cell
				occupiedGrid.SetCell (r + cell.Row, c + cell.Col, true);

				for (int i = r + cell.Row - 1; i <= r + cell.Row + 1; i++) {
					for (int j = c + cell.Col - 1; j <= c + cell.Col + 1; j++) {
						if (i >= 0 && i < levelPGrid.Height
							&& j >= 0 && j < levelPGrid.Width) {
							levelPGrid.SetCell (i, j, true);
							//GameManager.objects.Create (ResourcePaths.SpotMarker, new Vector3 (j+.5f, -i-.5f, 0), Quaternion.identity);
						}
					}
				}
			}
		}
	}