Example #1
0
        /**
         * Get the hair color of a Farmer or NPC
         */
        public static Color GetHairColor(Character character)
        {
            // If character is a Farmer, return their hair color
            if (character is Farmer farmer)
            {
                return(farmer.hairstyleColor.Value);
            }

            // If character is an NPC, return their hair color
            if (character is NPC npc && Blender.NPC_HAIR.TryGetValue(npc.Name, out Color color))
            {
                return(color);
            }

            // Create a new random hair color (Fallback)
            return(Blender.NaturalHairColor());
        }
Example #2
0
 /**
  * Get a random hair color using two parents
  */
 public static Color HairColor(Character parent1, Character parent2) => Blender.AreAdopters(parent1, parent2) ? Blender.NaturalHairColor() : Blender.GetHairColor(parent1).Blend(Blender.GetHairColor(parent2));