/// <summary> /// /// </summary> private void InitializeCells() { _layers = new CellLayer[_layerCount]; // instantiate layers for (int i = 0; i < _layerCount; i++) { CellLayer copy = Instantiate(_layerPrefab, transform); copy.transform.localPosition = new Vector3(0.0f, i, 0.0f); // create cell layer copy.Initialize(_cellPrefab, _rowCount, _columnCount); _layers[i] = copy; } // center at the world origin transform.localPosition = new Vector3(_columnCount, _layerCount, _rowCount) * -0.5f; }
/// <summary> /// Instantiates the cells / cell layers /// </summary> private void InitializeCells() { //initiate array with the number of layers _layers = new CellLayer[_layerCount]; // instantiate layers for (int i = 0; i < _layerCount; i++) { //instantiate each layer and move to its correct location in the stack CellLayer copy = Instantiate(_layerPrefab, transform); copy.transform.localPosition = new Vector3(0.0f, i, 0.0f); // create cell layer by running its initialize function copy.Initialize(_cellPrefab, _rowCount, _columnCount); //put the instantiated layer copy into the correct location in the array _layers[i] = copy; } // place all layers at the center at the world origin transform.localPosition = new Vector3(_columnCount, _layerCount, _rowCount) * -0.5f; }