public static float GetRandomSecondParentSkinColor(float otherParentSkin, float childSkin, float?secondChildSkin = null) { float mirror; if (secondChildSkin != null) { mirror = (childSkin + secondChildSkin.Value) / 2f; } else { mirror = childSkin; } float reflectedSkin = ChildRelationUtility.GetReflectedSkin(otherParentSkin, mirror); float num = childSkin; float num2 = childSkin; if (secondChildSkin != null) { num = Mathf.Min(num, secondChildSkin.Value); num2 = Mathf.Max(num2, secondChildSkin.Value); } float clampMin = 0f; float clampMax = 1f; if (reflectedSkin >= num2) { clampMin = num2; } else { clampMax = num; } return(PawnSkinColors.GetRandomMelaninSimilarTo(reflectedSkin, clampMin, clampMax)); }
public static float GetRandomSecondParentSkinColor(float otherParentSkin, float childSkin, float?secondChildSkin = default(float?)) { float num = 0f; num = (float)((!secondChildSkin.HasValue) ? childSkin : ((childSkin + secondChildSkin.Value) / 2.0)); float reflectedSkin = ChildRelationUtility.GetReflectedSkin(otherParentSkin, num); float num2 = childSkin; float num3 = childSkin; if (secondChildSkin.HasValue) { num2 = Mathf.Min(num2, secondChildSkin.Value); num3 = Mathf.Max(num3, secondChildSkin.Value); } float clampMin = 0f; float clampMax = 1f; if (reflectedSkin >= num3) { clampMin = num3; } else { clampMax = num2; } return(PawnSkinColors.GetRandomMelaninSimilarTo(reflectedSkin, clampMin, clampMax)); }
private static float GetNewParentSkinColorFactor(float?newParentMelanin, float?otherParentMelanin, float?childMelanin) { if (newParentMelanin.HasValue) { if (!otherParentMelanin.HasValue) { if (childMelanin.HasValue) { return(ChildRelationUtility.GetMelaninSimilarityFactor(newParentMelanin.Value, childMelanin.Value)); } return(PawnSkinColors.GetMelaninCommonalityFactor(newParentMelanin.Value)); } if (childMelanin.HasValue) { float reflectedSkin = ChildRelationUtility.GetReflectedSkin(otherParentMelanin.Value, childMelanin.Value); return(ChildRelationUtility.GetMelaninSimilarityFactor(newParentMelanin.Value, reflectedSkin)); } float melanin = (float)((newParentMelanin.Value + otherParentMelanin.Value) / 2.0); return(PawnSkinColors.GetMelaninCommonalityFactor(melanin)); } if (!otherParentMelanin.HasValue) { if (childMelanin.HasValue) { return(PawnSkinColors.GetMelaninCommonalityFactor(childMelanin.Value)); } return(1f); } if (childMelanin.HasValue) { float reflectedSkin2 = ChildRelationUtility.GetReflectedSkin(otherParentMelanin.Value, childMelanin.Value); return(PawnSkinColors.GetMelaninCommonalityFactor(reflectedSkin2)); } return(PawnSkinColors.GetMelaninCommonalityFactor(otherParentMelanin.Value)); }
private static float GetNewParentSkinColorFactor(float?newParentMelanin, float?otherParentMelanin, float?childMelanin) { float result; if (newParentMelanin != null) { if (otherParentMelanin == null) { if (childMelanin != null) { result = ChildRelationUtility.GetMelaninSimilarityFactor(newParentMelanin.Value, childMelanin.Value); } else { result = PawnSkinColors.GetMelaninCommonalityFactor(newParentMelanin.Value); } } else if (childMelanin != null) { float reflectedSkin = ChildRelationUtility.GetReflectedSkin(otherParentMelanin.Value, childMelanin.Value); result = ChildRelationUtility.GetMelaninSimilarityFactor(newParentMelanin.Value, reflectedSkin); } else { float melanin = (newParentMelanin.Value + otherParentMelanin.Value) / 2f; result = PawnSkinColors.GetMelaninCommonalityFactor(melanin); } } else if (otherParentMelanin == null) { if (childMelanin != null) { result = PawnSkinColors.GetMelaninCommonalityFactor(childMelanin.Value); } else { result = 1f; } } else if (childMelanin != null) { float reflectedSkin2 = ChildRelationUtility.GetReflectedSkin(otherParentMelanin.Value, childMelanin.Value); result = PawnSkinColors.GetMelaninCommonalityFactor(reflectedSkin2); } else { result = PawnSkinColors.GetMelaninCommonalityFactor(otherParentMelanin.Value); } return(result); }