private static void GenerateParentParams(float minChronologicalAge, float maxChronologicalAge, float midChronologicalAge, float minBioAgeToHaveChildren, Pawn generatedChild, Pawn existingChild, PawnGenerationRequest childRequest, out float biologicalAge, out float chronologicalAge, out float melanin, out string lastName) { chronologicalAge = Rand.GaussianAsymmetric(midChronologicalAge, (float)((midChronologicalAge - minChronologicalAge) / 2.0), (float)((maxChronologicalAge - midChronologicalAge) / 2.0)); chronologicalAge = Mathf.Clamp(chronologicalAge, minChronologicalAge, maxChronologicalAge); biologicalAge = Rand.Range(minBioAgeToHaveChildren, Mathf.Min(existingChild.RaceProps.lifeExpectancy, chronologicalAge)); if (existingChild.GetFather() != null) { melanin = ParentRelationUtility.GetRandomSecondParentSkinColor(existingChild.GetFather().story.melanin, existingChild.story.melanin, childRequest.FixedMelanin); } else if (existingChild.GetMother() != null) { melanin = ParentRelationUtility.GetRandomSecondParentSkinColor(existingChild.GetMother().story.melanin, existingChild.story.melanin, childRequest.FixedMelanin); } else if (!childRequest.FixedMelanin.HasValue) { melanin = PawnSkinColors.GetRandomMelaninSimilarTo(existingChild.story.melanin, 0f, 1f); } else { float num = Mathf.Min(childRequest.FixedMelanin.Value, existingChild.story.melanin); float num2 = Mathf.Max(childRequest.FixedMelanin.Value, existingChild.story.melanin); if (Rand.Value < 0.5) { melanin = PawnSkinColors.GetRandomMelaninSimilarTo(num, 0f, num); } else { melanin = PawnSkinColors.GetRandomMelaninSimilarTo(num2, num2, 1f); } } lastName = null; if (!ChildRelationUtility.DefinitelyHasNotBirthName(existingChild) && ChildRelationUtility.ChildWantsNameOfAnyParent(existingChild)) { if (existingChild.GetMother() == null && existingChild.GetFather() == null) { if (Rand.Value < 0.5) { lastName = ((NameTriple)existingChild.Name).Last; } } else { string last = ((NameTriple)existingChild.Name).Last; string b = null; if (existingChild.GetMother() != null) { b = ((NameTriple)existingChild.GetMother().Name).Last; } else if (existingChild.GetFather() != null) { b = ((NameTriple)existingChild.GetFather().Name).Last; } if (last != b) { lastName = last; } } } }
private static void ResolveMySkinColor(ref PawnGenerationRequest request, Pawn child, Pawn otherParent) { if (!request.FixedMelanin.HasValue) { if (otherParent != null) { request.SetFixedMelanin(ParentRelationUtility.GetRandomSecondParentSkinColor(otherParent.story.melanin, child.story.melanin)); } else { request.SetFixedMelanin(PawnSkinColors.GetRandomMelaninSimilarTo(child.story.melanin)); } } }