void Start() { //Instantiate controller m_evolution = new DNABasedEvolutionManager <MindBodyDNDNA <ResourceFightDNCreature> >( new MindBodySpeciesDN <ResourceFightDNCreature>(0, new TraitGenesSpecies(0, new HashSet <string> { "SPEED", "HEALTH", "DAMAGE", "ENERGY", "ATTACKSPEED" }, 1, new Range <float>(2f, 2f), 0, new Range <float>(0f, 0f)), new DecisionNetSpecies <ResourceFightDNCreature>(0, ResourceFightDNCreature.getInputFactorys(), ResourceFightDNCreature.getOutputFactorys(), new Range <float>(0.8f, 1.2f)) ), 0.1f, 20, (float p_fitness) => { return(p_fitness * 0.95f); }, 1f ); //Fill with 20 random for (int i = 0; i < 10; i++) { m_evolution.addRandom(); } //Instantaite Interval and Listeners m_interval = new IntervalEventManager(); for (int i = 0; i < 5; i++) { spawnResource(); } for (int i = 0; i < 50; i++) { spawnCreature(); } // spawnCreature(); // spawnCreature(); m_interval.addListener(5f, () => { for (int i = 0; i < 5; i++) { spawnCreature(); } }); m_interval.addListener(10f, () => { for (int i = 0; i < 1; i++) { spawnResource(); } }); m_interval.addListener(30f, () => { GameObject[] obs = ObjectLogger.getByType("CREATURE"); foreach (GameObject ob in obs) { ob.GetComponent <ResourceFightDNCreature>().logFitness(); } }); }
void Start() { Time.fixedDeltaTime = 0.04f; trial = DataCollector.Trials; setUpAI(); setUpData(); Task t1 = Task.Factory.StartNew(() => { m_evolution = createManager(); for (int i = 0; i < m_evolution.Size; i++) { m_evolution.addRandom(); } }); m_interval = new IntervalEventManager(); m_interval.addListener(0.2f, () => { Task t2 = Task.Factory.StartNew(() => { m_goalLine.rotate(1f); }); }); t1.Wait(); m_interval.addListener(lineFollowCONFIG.ControllerSpawnLatency, () => { for (int i = 0; i < lineFollowCONFIG.ControllerCreatureSpawnAmount; i++) { spawn(); } }); }
void Start() { Time.fixedDeltaTime = 0.04f; trial = DataCollector.Trials; setUpAI(); setUpData(); Task t1 = Task.Factory.StartNew(() => { m_evolution = createManager(); for (int i = 0; i < m_evolution.Size; i++) { m_evolution.addRandom(); } }); m_interval = new IntervalEventManager(); t1.Wait(); for (int i = 0; i < 15; i++) { spawn(); } }