/// <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++) { Cell cell = Instantiate(_cellPrefab, transform); cell.transform.localPosition = new Vector3(x, y, 0); _cells[y, x] = cell; } } // create model _model = new GameOfLife2D(_countY, _countX); // initialize model _initializer.Initialize(_model.CurrentState); coroutine = ShowAge(); StartCoroutine(coroutine); }
/// <summary> /// /// </summary> private void Start() { // create cell array _cells = new Cell[_countY, _countX]; _properties = new MaterialPropertyBlock(); // instantiate cell prefabs and store in array for (int y = 0; y < _countY; y++) { for (int x = 0; x < _countX; x++) { Cell cell = Instantiate(_cellPrefab, transform); cell.transform.localPosition = new Vector3(x, y, 0); _cells[y, x] = cell; } } //Debug.Log("a"); //Debug.Log("b"); // create model _model = new GameOfLife2D(_countY, _countX); // initialize model _initializer.Initialize(_model.CurrentState); }
private void OnGUI() { if (GUI.Button(new Rect(20, 20, 200, 50), "Restart")) { _model = new GameOfLife2D(_countY, _countX); _initializer.Initialize(_model.CurrentState); for (int y = 0; y < _countY; y++) { for (int x = 0; x < _countX; x++) { _cells[y, x].Age = 0; _cells[y, x].GetComponent <Renderer>().material.color = Color.black; } } } if (GUI.Button(new Rect(650, 20, 200, 50), "2,3,3,3")) { _model._rules = Rules.Rule2333; } if (GUI.Button(new Rect(650, 100, 200, 50), "3,4,3,4")) { _model._rules = Rules.Rule3434; } }
/// <summary> /// /// </summary> private void Start() { // initialize my data structures _thisState = new int[_countY, _countX]; _cellAges = new int[_countY * _countX]; _layerDensityList = new List <float>(); // 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++) { Cell cell = Instantiate(_cellPrefab, transform); cell.transform.localPosition = new Vector3(x, y, 0); _cells[y, x] = cell; } } // create model _model = new GameOfLife2D(_countY, _countX); // initialize model _initializer.Initialize(_model.CurrentState); //call coroutine changeColCoroutine = ChangeColorPerTime(); StartCoroutine(changeColCoroutine); if (Time.time > 1) { StopCoroutine(changeColCoroutine); StopAllCoroutines(); } }