/// Set the cell material. public void SetCellMaterial(int row, int column, Cell.MaterialType material) { m_cells[row * m_column + column].material = material; if (m_viewType == ViewType.MaterialView) { SetGridColor(row, column, GetMaterialColor(material)); } }
private void PaintMaterialBrushRect(int size, Grid grid, Cell.MaterialType material) { for (int i = -size; i <= size; ++i) { for (int j = -size; j <= size; ++j) { PaintMaterialPoint(m_mouseRow + i, m_mouseColumn + j, grid, material); } } }
private void PaintMaterialBrushCross(int size, Grid grid, Cell.MaterialType material) { for (int i = -size; i <= size; ++i) { for (int j = -size; j <= size; ++j) { if (Mathf.Abs(i) + Mathf.Abs(j) > size) { continue; } PaintMaterialPoint(m_mouseRow + i, m_mouseColumn + j, grid, material); } } }
private Color32 GetMaterialColor(Cell.MaterialType material) { switch (material) { case Cell.MaterialType.Wood: return(ColorWood); case Cell.MaterialType.Metal: return(ColorMetal); case Cell.MaterialType.Brick: return(ColorBrick); case Cell.MaterialType.Cobble: return(ColorCobble); case Cell.MaterialType.Dirty: return(ColorDirty); case Cell.MaterialType.Sand: return(ColorSand); case Cell.MaterialType.Leaf: return(ColorLeaf); case Cell.MaterialType.Grass: return(ColorGrass); case Cell.MaterialType.Snow: return(ColorSnow); case Cell.MaterialType.Water: return(ColorWater); } return(new Color32(0, 0, 0, 1)); }
private void PaintMaterialPoint(int i, int j, Grid grid, Cell.MaterialType material) { grid.SetCellMaterial(i, j, material); }