private static void ResolveMyName(ref PawnGenerationRequest request, Pawn child, Pawn otherParent)
 {
     if (request.FixedLastName != null)
     {
         return;
     }
     if (ChildRelationUtility.DefinitelyHasNotBirthName(child))
     {
         return;
     }
     if (ChildRelationUtility.ChildWantsNameOfAnyParent(child))
     {
         if (otherParent == null)
         {
             float num = 0.9f;
             if (Rand.Value < num)
             {
                 request.SetFixedLastName(((NameTriple)child.Name).Last);
             }
         }
         else
         {
             string last  = ((NameTriple)child.Name).Last;
             string last2 = ((NameTriple)otherParent.Name).Last;
             if (last != last2)
             {
                 request.SetFixedLastName(last);
             }
         }
     }
 }
 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 ResolveMyName(ref PawnGenerationRequest request, Pawn generated)
 {
     if (request.FixedLastName == null && ChildRelationUtility.ChildWantsNameOfAnyParent(generated))
     {
         if (Rand.Value < 0.5)
         {
             request.SetFixedLastName(((NameTriple)generated.GetFather().Name).Last);
         }
         else
         {
             request.SetFixedLastName(((NameTriple)generated.GetMother().Name).Last);
         }
     }
 }
Beispiel #4
0
 private static void ResolveMyName(ref PawnGenerationRequest request, Pawn generatedChild)
 {
     if (request.FixedLastName == null)
     {
         if (ChildRelationUtility.ChildWantsNameOfAnyParent(generatedChild))
         {
             bool flag = Rand.Value < 0.5f || generatedChild.GetMother() == null;
             if (generatedChild.GetFather() == null)
             {
                 flag = false;
             }
             if (flag)
             {
                 request.SetFixedLastName(((NameTriple)generatedChild.GetFather().Name).Last);
             }
             else
             {
                 request.SetFixedLastName(((NameTriple)generatedChild.GetMother().Name).Last);
             }
         }
     }
 }