public static void ShowParticle(this string Particle, Vector3 pos) { ParticleProfil findedparticle = ParticleWorker.instance.particles.Find(x => x.ParticleID == Particle); GameObject createparticle = ParticleWorker.Instantiate(findedparticle.particle, pos, Quaternion.identity); ParticleWorker.Destroy(createparticle.gameObject, 2f); }
private void ThreadOpto_Click(object sender, EventArgs e) { //MessageBox.Show("Sorry this currently needs more development" +Environment.NewLine + "Complete will show when thread has stopped."); Evaluation.Series["Genetic Algorythm"].Points.Clear(); Evaluation.Series["Particle Swarm"].Points.Clear(); Result_Box.Clear(); int k, GeneNumber = Convert.ToInt32(Gene_Number.Text), PoolSize = Convert.ToInt32(Pool_Size.Text), Cycles = Convert.ToInt32(Num_Cycles.Text); if (!int.TryParse(Pool_Size.Text, out k) && (!int.TryParse(Num_Cycles.Text, out k))) { MessageBox.Show("You must enter a whole number"); } else if ((GeneNumber > 10) || (GeneNumber < 2)) { MessageBox.Show("There must be more then one gene"); } else { //not the correct way to thread apparently, does not work GeneticWorker.RunWorkerAsync(GeneticAlgorythm(PoolSize, Cycles, GeneNumber)); ParticleWorker.RunWorkerAsync(ParticleSwarm(PoolSize, Cycles)); Result_Box.Text = Result_Box.Text + Environment.NewLine + "Completed"; } }
private void Awake() { instance = this; }