void MakeCell(Cell cell, int x, int y, SplitCell s) { GameObject c = Instantiate(Cell, new Vector3(x, y, 0), Quaternion.identity) as GameObject; BoxBehaviour b = c.GetComponent <BoxBehaviour>(); b.openColor = cell.getColor(); b.kitty = cell.isHealthy(); b.splitCell = s; if (s.solved) { b.openOnStart(); } b.mode = playerData.CurrentPlayer.settings.playmode; pw.puzzleCount++; }
public void refreshTexture() { texture = new Texture2D(cells.Count * 50, cells[0].Count * 50); Color[] colors = new Color[cells.Count * 50 * cells[0].Count * 50]; int h = 0; for (int i = cells.Count; i > 0; i--) { for (int l = 0; l < 50; l++) { for (int j = 0; j < cells[0].Count; j++) { for (int k = 0; k < 50; k++) { SplitCell splitCell = cells[i - 1][j]; colors[h++] = (splitCell.solved) ? splitCell.color : Color.black; } } } } texture.SetPixels(colors); texture.Apply(); }
void SplitCells() { //we can split some of the voronoi cells for smaller internal patterns List <GameObject> originalCells = new List <GameObject>(cells); //we will split only one cell at the moment cellsToSplit.Add(cells[UnityEngine.Random.Range(0, cells.Count)]); while (cellsToSplit.Count > 0) { //need to add adjacent cells stuff to new cells SplitCell splitCell = cellsToSplit[0].AddComponent <SplitCell>(); splitCell.meshGenerator = this; splitCell.minSize = minSplitSize; splitCell.Start(); cellsToSplit.RemoveAt(0); Edges(); CalculateAdjacents(); } }