public SeedSelection(ArtefactSeed seed, GameObject selectionGfx, int index) { this.seed = seed; this.selectionGfx = selectionGfx; this.indexInInventory = index; }
private void DeselectSeed(ArtefactSeed seed) { var index = -1; for(int i = 0; i < seedSelections.Count; i++) { if (seedSelections[i].seed == seed) { Destroy(seedSelections[i].selectionGfx); index = i; } } seedSelections.RemoveAt(index); if (showingPlantIcon && seedSelections.Count == 0) { showingPlantIcon = false; plantIcon.PopDown(); } }
private bool HasSelectedSeed(ArtefactSeed seed) { return seedSelections.Any(seedSelection => seedSelection.seed == seed); }
private void SelectSeed(ArtefactSeed seed) { var selectionGfx = Instantiate(seedSelectionGfx); selectionGfx.transform.parent = seed.transform; selectionGfx.transform.localPosition = seedSelectionGfx.transform.position; selectionGfx.transform.localScale = new Vector3(13.6f, 7.8f, 1f); seedSelections.Add(new SeedSelection(seed, selectionGfx, scrollView.selectedIndex)); plantIconCount++; if (!showingPlantIcon && plantIconCount < plantIconMax) { showingPlantIcon = true; plantIcon.PopUp(); } }
private string CombineSeeds(ArtefactSeed seed1, ArtefactSeed seed2) { var genome1 = NeatGenomeXmlIO.ReadGenome(XmlReader.Create(new StringReader(seed1.SerializedGenome)), true); genome1.GenomeFactory = EvolutionHelper.Instance.GenomeFactory; var genome2 = NeatGenomeXmlIO.ReadGenome(XmlReader.Create(new StringReader(seed2.SerializedGenome)), true); genome2.GenomeFactory = EvolutionHelper.Instance.GenomeFactory; var result = genome1.CreateOffspring(genome2, (uint)Mathf.Max(genome1.BirthGeneration, genome2.BirthGeneration) + 1); return NeatGenomeXmlIO.Save(result, true).OuterXml; }