/// <summary> /// Creates the creature and attached it to the evolution. /// </summary> public void AttachCreatureToEvolution(Evolution evolution) { ResetHoverableColliders(); CreatureSaver.SaveCurrentCreature(lastCreatureName, joints, bones, muscles); Creature creature = BuildCreature(); DontDestroyOnLoad(creature.gameObject); evolution.creature = creature; }
/** Generates a creature and starts the evolution simulation. */ public void Evolve() { // don't attempt evolution if there is no creature if (joints.Count == 0) { return; } ResetHoverableColliders(); CreatureSaver.SaveCurrentCreature(lastCreatureName, joints, bones, muscles); Creature creature = BuildCreature(); DontDestroyOnLoad(creature.gameObject); //SceneManager.LoadScene("EvolutionScene"); AsyncOperation sceneLoading = SceneManager.LoadSceneAsync("EvolutionScene"); //AsyncOperation sceneLoading = SceneManager.LoadSceneAsync("TestEvolutionScene"); sceneLoading.allowSceneActivation = true; DontDestroyOnLoad(evolution.gameObject); evolution.creature = creature; //evolution.PopulationSize = buttonManager.GetPopulationInput(); //evolution.SimulationTime = buttonManager.GetSimulationTime(); var settings = settingsMenu.GetEvolutionSettings(); //evolution.PopulationSize = settings.populationSize; //evolution.SimulationTime = settings.simulationTime; //Evolution.task = buttonManager.GetTask(); //Evolution.task = settings.task; evolution.Settings = settings; evolution.BrainSettings = settingsMenu.GetNeuralNetworkSettings(); SetMobileNoSleep(); StartCoroutine(WaitForEvolutionSceneToLoad(sceneLoading)); DontDestroyOnLoad(this); //evolution.StartEvolution(); //Time.timeScale = 5.0f; }