public void RunBest()
{
Time.timeScale = 1;
NeatGenome genome = null;
// Try to load the genome from the XML document.
try
{
using (XmlReader xr = XmlReader.Create(champFileSavePath))
genome = NeatGenomeXmlIO.ReadCompleteGenomeList(xr, false, (NeatGenomeFactory)experiment.CreateGenomeFactory())[0];
}
catch (Exception e1)
{
// print(champFileLoadPath + " Error loading genome from file!\nLoading aborted.\n"
// + e1.Message + "\nJoe: " + champFileLoadPath);
return;
}
// Get a genome decoder that can convert genomes to phenomes.
var genomeDecoder = experiment.CreateGenomeDecoder();
// Decode the genome into a phenome (neural network).
var phenome = genomeDecoder.Decode(genome);
GameObject obj = Instantiate(Unit, Unit.transform.position, Unit.transform.rotation) as GameObject;
UnitController controller = obj.GetComponent <UnitController>();
ControllerMap.Add(phenome, controller);
controller.Activate(phenome);
}