void Update()
 {
     if (Input.GetKeyDown(KeyCode.Q))
     {
         ChildStats = ChildPandaCreator.CreateChildStats(FatherStats, MotherStats);
     }
 }
        public PandaStats CreateChildStats(PandaStats father, PandaStats mother)
        {
            _random = new Random(_createdPandasCount++);
            Assert.IsTrue(father.Genotype.Count == mother.Genotype.Count);

            var newGenotype = DrawSingleValuesAndMutate(father.Genotype)
                              .Join(DrawSingleValuesAndMutate(mother.Genotype), c => c.Trait, c => c.Trait,
                                    (fatherGene, motherGene) => new Gene()
            {
                FatherGene = fatherGene.Value, MotherGene = motherGene.Value, Trait = fatherGene.Trait
            })
                              .ToList();
            Phenotype newPhenotype = CreatePhenotype(newGenotype);

            var gender = _random.NextBool() ? Gender.Male : Gender.Female;

            return(new PandaStats()
            {
                name = $"Panda No:{_createdPandasCount}",
                birthdate = _createdPandasCount,
                gender = gender,
                Genotype = newGenotype,
                Phenotype = newPhenotype
            });
        }
示例#3
0
 public void LoadPanda(PandaStats stats)
 {
     pandaName.text = stats.name;
     gender.text    = stats.gender.ToString();
     primaryColor.SetText(stats.Phenotype.primaryBodyColorTrait.ToString());
     secendaryColor.SetText(stats.Phenotype.secondaryColorTrait.ToString());
     eyeColor.SetText(stats.Phenotype.eyeColorTrait.ToString());
     eyeType.SetText(stats.Phenotype.eyesTypeTrait.ToString());
     earType.SetText(stats.Phenotype.earTypeTrait.ToString());
     mouthNoseType.SetText(stats.Phenotype.noseMouthTypeTrait.ToString());
     tailType.SetText(stats.Phenotype.tailTypeTrait.ToString());
     bodyType.SetText(stats.Phenotype.bodyTypeTrait.ToString());
     specialType.SetText(stats.Phenotype.specialTrait.ToString());
 }
示例#4
0
 public void SetStats(PandaStats stats)
 {
     _stats = stats;
 }