private void Awake() { _cellController = GetComponentInParent<CellController>(); _firstMaterial = _cellController.FirstSide.GetComponent<MeshRenderer>().material; _secondMaterial = _cellController.SecondSide.GetComponent<MeshRenderer>().material; }
private void Awake() { _cellController = GetComponentInParent<CellController>(); _rotate0 = new Vector3(0, 0, 315); _rotate180 = new Vector3(180, 0, 315); _rotate360 = new Vector3(360, 0, 315); }
private Cell.CellController[,] GetPaintArray(Color baseColor, Color newColor) { var arrPaint = new Cell.CellController[Width, Height]; var cells = new ArrayList(); cells.Add(_cells[0, Height - 1]); while (cells.Count > 0) { var cell = cells[0] as Cell.CellController; for (int x = cell.X; x >= 0; x--) { if (_cells[x, cell.Y].Color != baseColor) break; arrPaint[x, cell.Y] = _cells[x, cell.Y]; if (cell.Y + 1 < Height) if (arrPaint[x, cell.Y + 1] == null && _cells[x, cell.Y + 1].Color == baseColor) cells.Add(_cells[x, cell.Y + 1]); if (cell.Y - 1 >= 0) if (arrPaint[x, cell.Y - 1] == null && _cells[x, cell.Y - 1].Color == baseColor) cells.Add(_cells[x, cell.Y - 1]); } for (int x = cell.X; x < Width; x++) { if (_cells[x, cell.Y].Color != baseColor) break; arrPaint[x, cell.Y] = _cells[x, cell.Y]; if (cell.Y + 1 < Height) if (arrPaint[x, cell.Y + 1] == null && _cells[x, cell.Y + 1].Color == baseColor) cells.Add(_cells[x, cell.Y + 1]); if (cell.Y - 1 >= 0) if (arrPaint[x, cell.Y - 1] == null && _cells[x, cell.Y - 1].Color == baseColor) cells.Add(_cells[x, cell.Y - 1]); } cells.Remove(cell); } for (int x = 0; x < Width; x++) for (int y = 0; y < Height; y++) if (arrPaint[x, y] != null) arrPaint[x, y].Color = newColor; return arrPaint; }