/// <summary> /// /// </summary> private void Start() { _model = GetComponent <StackModelManager>(); _analyser = GetComponent <StackAnalyser>(); _properties = new MaterialPropertyBlock(); ResetDisplay(); }
//calculate max age in the stack (by lu) // Calculate mean density in each level (written by Lu) private void CalculateEachLevelDensity(StackModelManager model) { //get current layer int currentLayer = _model.CurrentLayer; CellLayer layer = _model.Stack.Layers[currentLayer]; int aliveCount = 0; // get cells in layers var cells = layer.Cells; //outcome float _densityLevel1; float _densityLevel2; float _densityLevel3; if (currentLayer <= 30) { foreach (var cell in cells) { aliveCount += cell.State; _densityLevel1 = (float)aliveCount / cells.Length; _densityLevels[0] = _densityLevel1; } } if (currentLayer > 30 && currentLayer < 60) { foreach (var cell in cells) { aliveCount += cell.State; _densityLevel2 = (float)aliveCount / cells.Length; _densityLevels[1] = _densityLevel2; } } if (currentLayer >= 60) { foreach (var cell in cells) { aliveCount += cell.State; _densityLevel3 = (float)aliveCount / cells.Length; _densityLevels[2] = _densityLevel3; } } ; }
/// <summary> /// /// </summary> private void Start() { //provides access to the stackmodel and stackdisplay for running their function _model = GetComponent <StackModelManager>(); _display = GetComponent <StackDisplay>(); }
/// <summary> /// /// </summary> private void Start() { //access to the stack model + analyser as components of the same gameObject "this" script is attached to _modelManager = GetComponent <StackModelManager>(); _analyser = GetComponent <StackAnalyser>(); }
private int _currentLayer; // index of the most recently analysed layer /// <summary> /// /// </summary> private void Start() { _model = GetComponent <StackModelManager>(); ResetAnalysis(); }
/// <summary> /// /// </summary> private void Start() { _model = GetComponent <StackModelManager>(); _analyser = GetComponent <StackAnalyser>(); _dna = _model.Stack.DNA; }