Example #1
0
    public void Init()
    {
        cellView             = GetComponent <CellView>();
        cellView.CountOfCell = CountOfCell;
        cellView.CellAtIndex = CellAtIndex;

        cellView.Init();
    }
Example #2
0
    // Start is called before the first frame update
    internal void Init(Sprite[] _sprites)
    {
        //cellModel.pos will be assigned later in CellsModel
        cellModel.from        = cellModel.to = cellModel.pos;
        cellModel.willDestroy = false;
        cellModel.isNew       = false;
        cellModel.value       = 0;

        cellView = GetComponent <CellView>();
        cellView.Init(_sprites);
    }
Example #3
0
    private void PrepareBoardCells()
    {
        int offsetX = width / 2;
        int offsetY = height / 2;

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                if (viewGrid[x, y] == null)
                {
                    // cellView was never created
                    Vector3  position = new Vector3(x - offsetX, -y + offsetY, 0);
                    CellView view     = Instantiate <CellView>(cellPF, position, Quaternion.identity);
                    viewGrid[x, y] = view;
                    view.Init(dataGrid[x, y]);
                }

                viewGrid[x, y].PerformAction();
            }
        }
    }