/// <summary> /// /// </summary> private void Start() { // create cell array _cells = new Cell[_countY, _countX]; // instantiate cell prefabs and store in array for (int y = 0; y < _countY; y++) { for (int x = 0; x < _countX; x++) { //instantiate a new cell using the cell prefab Cell cell = Instantiate(_cellPrefab, transform); //move the cell's position to correct location based on the index cell.transform.localPosition = new Vector3(x, 0, y); //store the newly created cell in the cells 2d array _cells[y, x] = cell; } } // create model using the rule attached to this component _rule = GetComponent <ICARule2D>(); _model = new CAModel2D(_rule, _countY, _countX); // initialize model _initializer.Initialize(_model.CurrentState); // create display _display = new ModelDisplay(); _display.Initialize(_countX, _countY, _cells); }
/// <summary> /// Resets the model /// </summary> public void ResetModel() { // initialize model _initializer.Initialize(_model.CurrentState); // create display _display = new ModelDisplay(); _display.Initialize(_countX, _countY, _cells); }