Пример #1
0
 public static Color RandomHairColor(Color skinColor, int ageYears, int getsGrayAt)
 {
     if (Rand.Value < 0.02f)
     {
         return(new Color(Rand.Value, Rand.Value, Rand.Value));
     }
     if (ageYears > (getsGrayAt + Rand.Range(-0.3f * getsGrayAt, 0.1f * getsGrayAt)))
     {
         float num = GenMath.SmootherStep(40f, 75f, (float)ageYears);
         if (Rand.Value < num)
         {
             float num2 = Rand.Range(0.65f, 0.85f);
             return(new Color(num2, num2, num2));
         }
     }
     if (PawnSkinColors.IsDarkSkin(skinColor) || Rand.Value < 0.5f)
     {
         float value = Rand.Value;
         if (value < 0.25f)
         {
             return(new Color(0.2f, 0.2f, 0.2f));
         }
         if (value < 0.5f)
         {
             return(new Color(0.31f, 0.28f, 0.26f));
         }
         if (value < 0.75f)
         {
             return(new Color(0.25f, 0.2f, 0.15f));
         }
         return(new Color(0.3f, 0.2f, 0.1f));
     }
     else
     {
         float value2 = Rand.Value;
         if (value2 < 0.25f)
         {
             return(new Color(0.3529412f, 0.227450982f, 0.1254902f));
         }
         if (value2 < 0.5f)
         {
             return(new Color(0.5176471f, 0.3254902f, 0.184313729f));
         }
         if (value2 < 0.75f)
         {
             return(new Color(0.75686276f, 0.572549045f, 0.333333343f));
         }
         return(new Color(0.929411769f, 0.7921569f, 0.6117647f));
     }
 }
Пример #2
0
 public override Color GetColor(Pawn pawn, List <string> options)
 {
     if (Rand.Value < 0.02f)
     {
         return(new Color(Rand.Value, Rand.Value, Rand.Value));
     }
     if (pawn.ageTracker.AgeBiologicalYears > (pawn.def as RaceAddonThingDef).raceAddonSettings.healthSetting.greyHairAt)
     {
         float num = GenMath.SmootherStep(40f, 75f, pawn.ageTracker.AgeBiologicalYears);
         if (Rand.Value < num)
         {
             float num2 = Rand.Range(0.65f, 0.85f);
             return(new Color(num2, num2, num2));
         }
     }
     if (PawnSkinColors.IsDarkSkin(pawn.story.SkinColor) || Rand.Value < 0.5f)
     {
         float value = Rand.Value;
         if (value < 0.25f)
         {
             return(new Color(0.2f, 0.2f, 0.2f));
         }
         if (value < 0.5f)
         {
             return(new Color(0.31f, 0.28f, 0.26f));
         }
         if (value < 0.75f)
         {
             return(new Color(0.25f, 0.2f, 0.15f));
         }
         return(new Color(0.3f, 0.2f, 0.1f));
     }
     else
     {
         float value2 = Rand.Value;
         if (value2 < 0.25f)
         {
             return(new Color(0.3529412f, 0.227450982f, 0.1254902f));
         }
         if (value2 < 0.5f)
         {
             return(new Color(0.5176471f, 0.3254902f, 0.184313729f));
         }
         if (value2 < 0.75f)
         {
             return(new Color(0.75686276f, 0.572549045f, 0.333333343f));
         }
         return(new Color(0.929411769f, 0.7921569f, 0.6117647f));
     }
 }
        public static Color RandomHairColor(Color skinColor, int ageYears)
        {
            if (Rand.Value < 0.019999999552965164)
            {
                return(new Color(Rand.Value, Rand.Value, Rand.Value));
            }
            if (ageYears > 40)
            {
                float num = GenMath.SmootherStep(40f, 75f, (float)ageYears);
                if (Rand.Value < num)
                {
                    float num2 = Rand.Range(0.65f, 0.85f);
                    return(new Color(num2, num2, num2));
                }
            }
            if (!PawnSkinColors.IsDarkSkin(skinColor) && !(Rand.Value < 0.5))
            {
                float value = Rand.Value;
                if (value < 0.25)
                {
                    return(new Color(0.3529412f, 0.227450982f, 0.1254902f));
                }
                if (value < 0.5)
                {
                    return(new Color(0.5176471f, 0.3254902f, 0.184313729f));
                }
                if (value < 0.75)
                {
                    return(new Color(0.75686276f, 0.572549045f, 0.333333343f));
                }
                return(new Color(0.929411769f, 0.7921569f, 0.6117647f));
            }
            float value2 = Rand.Value;

            if (value2 < 0.25)
            {
                return(new Color(0.2f, 0.2f, 0.2f));
            }
            if (value2 < 0.5)
            {
                return(new Color(0.31f, 0.28f, 0.26f));
            }
            if (value2 < 0.75)
            {
                return(new Color(0.25f, 0.2f, 0.15f));
            }
            return(new Color(0.3f, 0.2f, 0.1f));
        }
Пример #4
0
        public static Color RandomHairColor(Color skinColor, int ageYears)
        {
            if (Rand.Value < 0.02f)
            {
                return(new Color(Rand.Value, Rand.Value, Rand.Value));
            }
            if (ageYears > 40)
            {
                float num = GenMath.SmootherStep(40f, 75f, ageYears);
                if (Rand.Value < num)
                {
                    float num2 = Rand.Range(0.65f, 0.85f);
                    return(new Color(num2, num2, num2));
                }
            }
            if (PawnSkinColors.IsDarkSkin(skinColor) || Rand.Value < 0.5f)
            {
                float value = Rand.Value;
                if (value < 0.25f)
                {
                    return(new Color(0.2f, 0.2f, 0.2f));
                }
                if (value < 0.5f)
                {
                    return(new Color(0.31f, 0.28f, 0.26f));
                }
                if (value < 0.75f)
                {
                    return(new Color(0.25f, 0.2f, 0.15f));
                }
                return(new Color(0.3f, 0.2f, 0.1f));
            }
            float value2 = Rand.Value;

            if (value2 < 0.25f)
            {
                return(new Color(0.3529412f, 58f / 255f, 32f / 255f));
            }
            if (value2 < 0.5f)
            {
                return(new Color(44f / 85f, 83f / 255f, 47f / 255f));
            }
            if (value2 < 0.75f)
            {
                return(new Color(193f / 255f, 146f / 255f, 0.333333343f));
            }
            return(new Color(79f / 85f, 202f / 255f, 52f / 85f));
        }
Пример #5
0
        public static Color RandomHairColor(Color skinColor, int ageYears, int getsGrayAt)
        {
            bool  flag = Rand.Value < 0.02f;
            Color result;

            if (flag)
            {
                result = new Color(Rand.Value, Rand.Value, Rand.Value);
            }
            else
            {
                bool flag2 = (float)ageYears > (float)getsGrayAt + Rand.Range(-0.3f * (float)getsGrayAt, 0.1f * (float)getsGrayAt);
                if (flag2)
                {
                    float num   = GenMath.SmootherStep(40f, 75f, (float)ageYears);
                    bool  flag3 = Rand.Value < num;
                    if (flag3)
                    {
                        float num2 = Rand.Range(0.65f, 0.85f);
                        result = new Color(num2, num2, num2);
                        return(result);
                    }
                }
                bool flag4 = PawnSkinColors.IsDarkSkin(skinColor) || Rand.Value < 0.5f;
                if (flag4)
                {
                    float value = Rand.Value;
                    bool  flag5 = value < 0.25f;
                    if (flag5)
                    {
                        result = new Color(0.2f, 0.2f, 0.2f);
                    }
                    else
                    {
                        bool flag6 = value < 0.5f;
                        if (flag6)
                        {
                            result = new Color(0.31f, 0.28f, 0.26f);
                        }
                        else
                        {
                            bool flag7 = value < 0.75f;
                            if (flag7)
                            {
                                result = new Color(0.25f, 0.2f, 0.15f);
                            }
                            else
                            {
                                result = new Color(0.3f, 0.2f, 0.1f);
                            }
                        }
                    }
                }
                else
                {
                    float value2 = Rand.Value;
                    bool  flag8  = value2 < 0.25f;
                    if (flag8)
                    {
                        result = new Color(0.3529412f, 0.227450982f, 0.1254902f);
                    }
                    else
                    {
                        bool flag9 = value2 < 0.5f;
                        if (flag9)
                        {
                            result = new Color(0.5176471f, 0.3254902f, 0.184313729f);
                        }
                        else
                        {
                            bool flag10 = value2 < 0.75f;
                            if (flag10)
                            {
                                result = new Color(0.75686276f, 0.572549045f, 0.333333343f);
                            }
                            else
                            {
                                result = new Color(0.929411769f, 0.7921569f, 0.6117647f);
                            }
                        }
                    }
                }
            }
            return(result);
        }