/// <summary>
            ///
            /// </summary>
            private void Awake()
            {
                _currentStack          = _model.Stack;
                _currentGenerationData = new CellStackData[_genSize];
                _population.Reset();
                InitializeMatingPool();

                string filepath       = Application.dataPath + "/00-DataOutput";
                string dateAndTimeVar = System.DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss");

                filepath += "/" + dateAndTimeVar;
                filePath  = filepath;
                System.IO.Directory.CreateDirectory(filePath);

                //ONLY IF USING GENES FOR PARTIAL IMAGE SEEDS - synthesize 4 images from child genes - don't use this if you dont have genes for image textures
                if (_SeedFromGenes == true)
                {
                    Texture2D texture1 = _seeds[_currentStack.DNA.GetGene(0)];
                    Texture2D texture2 = _seeds[_currentStack.DNA.GetGene(1)];
                    Texture2D texture3 = _seeds[_currentStack.DNA.GetGene(2)];
                    Texture2D texture4 = _seeds[_currentStack.DNA.GetGene(3)];
                    Texture2D combined = ImageSynthesizer.CombineFour(texture1, texture2, texture3, texture4, _currentStack.RowCount, _currentStack.ColumnCount);

                    //place the synthesized image into the stack
                    _currentStack.SetSeed(combined);

                    //resets/initializes the model using the synthesized image
                    _model.ResetModel(combined);

                    //place the synthesized image into the stack
                    _currentStack.SetSeed(combined);

                    _analyser.ResetAnalysis();
                }
            }
            /// <summary>
            /// Keypresses that change the behaviour or visualisation of the game
            /// </summary>
            private void HandleKeyPress()
            {
                // Reset model
                if (Input.GetKeyDown(KeyCode.X))
                {
                    _model.ResetModel();
                }

                // Pause model
                else if (Input.GetKeyDown(KeyCode.P))
                {
                    _model.ExecutionMode = ModelExecutionMode.Pause;
                }

                // Step incrementally through execution of model
                else if (Input.GetKeyDown(KeyCode.S))
                {
                    _model.ExecutionMode = ModelExecutionMode.StepByStep;
                }

                //Run the model continuously
                else if (Input.GetKeyDown(KeyCode.R))
                {
                    _model.ExecutionMode = ModelExecutionMode.Run;
                }

                //Run the model continuously
                else if (Input.GetKeyDown(KeyCode.Space))
                {
                    _model.HasStepped = false;
                }

                // Update display mode
                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    _display.DisplayMode = CellDisplayMode.Age;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    _display.DisplayMode = CellDisplayMode.LayerDensity;
                }

                else if (Input.GetKeyDown(KeyCode.Alpha3))
                {
                    _display.DisplayMode = CellDisplayMode.NeighborDensity;
                }
            }
Beispiel #3
0
            /// <summary>
            /// Keypresses that change the behaviour or visualisation of the game
            /// </summary>
            private void HandleKeyPress()
            {
                // Reset model
                if (Input.GetKeyDown(KeyCode.X))
                {
                    _model.ResetModel();
                }

                // Pause model
                else if (Input.GetKeyDown(KeyCode.P))
                {
                    _model.ExecutionMode = ModelExecutionMode.Pause;
                }

                // Step incrementally through execution of model
                else if (Input.GetKeyDown(KeyCode.S))
                {
                    _model.ExecutionMode = ModelExecutionMode.StepByStep;
                }

                //Run the model continuously
                else if (Input.GetKeyDown(KeyCode.R))
                {
                    _model.ExecutionMode = ModelExecutionMode.Run;
                }

                //Run the model continuously
                else if (Input.GetKeyDown(KeyCode.Space))
                {
                    _model.HasStepped = false;
                }

                // Update display mode
                if (Input.GetKeyDown(KeyCode.Alpha0))
                {
                    if (_display.DisplayMode != CellDisplayMode.None)
                    {
                        _display.DisplayMode = CellDisplayMode.None;
                    }
                    else
                    {
                        _display.DisplayMode = CellDisplayMode.Alive;
                    }
                }

                // Update display mode
                else if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    _display.DisplayMode = CellDisplayMode.Age;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    _display.DisplayMode = CellDisplayMode.LayerDensity;
                }

                else if (Input.GetKeyDown(KeyCode.Alpha3))
                {
                    _display.DisplayMode = CellDisplayMode.MooreR1Density;
                }

                else if (Input.GetKeyDown(KeyCode.Alpha4))
                {
                    _display.DisplayMode = CellDisplayMode.VNR1Density;
                }

                else if (Input.GetKeyDown(KeyCode.Alpha5))
                {
                    _display.DisplayMode = CellDisplayMode.VNR2Density;
                }

                else if (Input.GetKeyDown(KeyCode.Alpha6))
                {
                    _display.DisplayMode = CellDisplayMode.FunnyDisplay;
                }

                else if (Input.GetKeyDown(KeyCode.Alpha7))
                {
                    _display.DisplayMode = CellDisplayMode.OldCells;
                }
            }