Beispiel #1
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));
    }
 private void Awake()
 {
     dictionary = new SpeciesDictionary();
 }