/// <summary>
        ///
        /// </summary>
        private void Awake()
        {
            _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;
            }

            // create rule
            _analyser = new StackAnalyser(this);
            MyCA rule = new MyCA(_analyser);

            // create model
            _model = new CAModel2D(rule, _rowCount, _columnCount);

            // initialize model
            _initializer.Initialize(_model.CurrentState);

            // center manager gameobject at the world origin
            transform.localPosition = new Vector3(_columnCount, _layerCount, _rowCount) * -0.5f;
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        private void Awake()
        {
            // create model
            _model = new CAModel2D(GetComponent <ICARule2D>(), _stack.RowCount, _stack.ColumnCount);

            // initialize model
            _initializer.Initialize(_model.CurrentState);
        }