Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    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();
    }
Esempio n. 3
0
    public void RemoveGeneticIcon(int id)
    {
        GeneticIcon   icon   = sampleToIconMap[id];
        GeneticSample sample = icon.sample;

        sampleToIconMap.Remove(id);
        Destroy(icon.gameObject);
        displayedSamples.Remove(sample);

        RearrangeIcons();
    }
Esempio n. 4
0
    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);
        }
    }
Esempio n. 5
0
    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);
        }
    }