private void Start() { startText.gameObject.SetActive(false); // Only populate one bird if for show is on m_weightOptimizer = new WeightOptimize(this, forShow? 1: batchBirdCount, batchBirdSurviveCount); // Start new batch of birds, if record file can be load use record genome if (genomeRecordFileName != "") { try { m_weightOptimizer.InsertGenome(SavingSystem.GetGenome <Genometype>(genomeRecordFileName)); } catch (System.IO.FileNotFoundException) { StartFromScratch(); } } else { StartFromScratch(); } m_gameStartTime = Time.unscaledTime; base.ResetGame(); }
private void Start() { m_aliveGenomes = new List <Genometype>(); m_weightOptimizers = new List <WeightOptimize>(); startText.gameObject.SetActive(false); if (SavingSystem.DataFileExist(saveFileName)) { readFileName = saveFileName; } if (readFileName != "") { GenomeStructEvolveData data; try { data = SavingSystem.GetGenome <GenomeStructEvolveData>(readFileName, readFileName.EndsWith("json")); } catch (System.IO.FileNotFoundException) { StartFromScratch(); m_gameStartTime = Time.unscaledTime; base.ResetGame(); return; } m_aliveGenomes.AddRange(data.aliveBirds); m_structureGenerationCount = data.structureGenerationCount; for (int i = 0; i < m_aliveGenomes.Count; i++) { m_weightOptimizers.Add(new WeightOptimize(this, genomeBirdCount, genomeBirdSurviveCount)); m_weightOptimizers[i].InsertGenome(m_aliveGenomes[i], fullyRandom: false); } } else { StartFromScratch(); } m_gameStartTime = Time.unscaledTime; base.ResetGame(); }