public void AddGeneticMaterial(Unit owner) { // TODO: check if clash int sampleId = Random.Range(0, 9999); GeneticSample newSample = new GeneticSample(owner, sampleId); geneticSamples.Add(newSample); breedingPopup.AddGeneticIcon(newSample); }
public void AddGeneticIcon(GeneticSample sample) { GameObject GeneticIconGO = Instantiate(geneticPrefab, geneticDock.transform); GeneticIconGO.GetComponent <GeneticIcon> ().Initialise(sample); sampleToIconMap [sample.id] = GeneticIconGO.GetComponent <GeneticIcon> (); displayedSamples.Add(sample); RearrangeIcons(); }
public void RemoveGeneticIcon(int id) { GeneticIcon icon = sampleToIconMap[id]; GeneticSample sample = icon.sample; sampleToIconMap.Remove(id); Destroy(icon.gameObject); displayedSamples.Remove(sample); RearrangeIcons(); }
public void Initialise(GeneticSample sample) { this.sample = sample; unitName.text = sample.unit.name; if (sample.unit.gender == Gender.Male) { unitName.color = new Color(.2f, .2f, 1f); } else { unitName.color = new Color(1f, .2f, .2f); } }
public void SpendGeneticMaterial(int sampleId) { GeneticSample toRemove = null; foreach (GeneticSample sample in geneticSamples) { if (sample.id == sampleId) { toRemove = sample; } } if (toRemove != null) { geneticSamples.Remove(toRemove); } }