示例#1
0
    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++;
    }
示例#2
0
    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();
    }
示例#3
0
    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();
        }
    }