Ejemplo n.º 1
0
        private void InitializeScenario()
        {
            pauseToolStripButton.PerformClick();

            _simulation.EnvironmentSeed          = (int)environmentSeedNumericUpDown.Value;
            _simulation.MovementSeed             = (int)movementSeedNumericUpDown.Value;
            _simulation.MinimumAttractorStrength = (int)minimumAttractorSizeNumericUpDown.Value;
            _simulation.MaximumAttractorStrength = (int)maximumAttractorSizeNumericUpDown.Value;
            _simulation.MinimumRepellentStrength = (int)minimumRepellentSizeNumericUpDown.Value;
            _simulation.MaximumRepellentStrength = (int)maximumRepellentSizeNumericUpDown.Value;
            _simulation.AttractorCollisionAction = (CollisionAction)(attractorCollisionModeComboBox.SelectedIndex + 1);
            _simulation.RepellentCollisionAction = (CollisionAction)(repellentCollisionModeComboBox.SelectedIndex + 1);
            _simulation.RespawnAttractor         = respawnAttractorsCheckBox.Checked;
            _simulation.BinaryFission            = allowBinaryFissionCheckBox.Checked;
            _simulation.Size             = new Size((int)widthNumericUpDown.Value, (int)heightNumericUpDown.Value);
            _simulation.Wrap             = wrapCheckBox.Checked;
            _simulation.SolidStrands     = solidStrandsCheckBox.Checked;
            _simulation.Attrition        = attritionCheckBox.Checked;
            _simulation.MobileRepellents = mobileRepellentsCheckBox.Checked;
            _simulation.Reset();

            for (int i = 0; i < (int)strandsNumericUpDown.Value; i++)
            {
                _simulation.AddStrand();
            }

            for (int i = 0; i < (int)attractorsNumericUpDown.Value; i++)
            {
                _simulation.AddAttractor();
            }

            for (int i = 0; i < (int)repellentsNumericUpDown.Value; i++)
            {
                _simulation.AddRepellent();
            }

            this.UpdateSimulationControls();
            this.UpdateStatusBar();

            renderPanel.Invalidate();
        }