Ejemplo n.º 1
0
    private List <PairChromosome> Inherit(List <PairChromosome> parent1, List <PairChromosome> parent2)
    {
        var list = new List <PairChromosome>();

        for (int i = 0; i < parent1.Count; ++i)
        {
            var item = PairChromosome.Inherit(parent1[i], parent2[i]);
            list.Add(item);
        }

        if (list[0].IsMutate(parent1[0], parent2[0]))
        {
            var mutationInfo = list[0].GetMutationInfo(parent1[0], parent1[0]);
            SetAllele(list, AlleleDictionary.GetAllele(mutationInfo.value), mutationInfo.isMain);
        }

        return(list);
    }
Ejemplo n.º 2
0
    public override Chromosome TryMutate(Chromosome parent)
    {
        List <SpeciesDictionary.MutationInfo> list = SpeciesDictionary.GetMutationInfo((ValueType)value);

        if (list != null)
        {
            var val = (ValueType)parent.GetValue();
            foreach (var item in list)
            {
                if (item.SecondSpecies == val)
                {
                    if (Random.value <= item.Chance)
                    {
                        return(AlleleDictionary.GetAllele(item.Result).species);
                    }
                }
            }
        }
        return(base.TryMutate(parent));
    }
Ejemplo n.º 3
0
 public void TryAddItemInInventory(int index)
 {
     Debug.Log($"Chose butn: {index}");
     inventoryManager.AddBee(new Bee(AlleleDictionary.GetAllele(BeeList[index].ValueType), BeeList[index].BeeType));
 }