Пример #1
0
        public override void SelectOption(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionAlienAddon addonOption = option as PawnLayerOptionAlienAddon;

            if (addonOption == null)
            {
                return;
            }
            if (pawn.AlienRace != null)
            {
                ThingComp alienComp = pawn.Pawn.AllComps.FirstOrDefault((ThingComp comp) => {
                    return(comp.GetType().Name == "AlienComp");
                });
                if (alienComp == null)
                {
                    return;
                }
                FieldInfo variantsField = ReflectionUtil.GetPublicField(alienComp, "addonVariants");
                if (variantsField == null)
                {
                    return;
                }
                List <int> variants = null;
                try {
                    variants = (List <int>)variantsField.GetValue(alienComp);
                }
                catch (Exception) {
                    return;
                }
                variants[AlienAddon.VariantIndex] = addonOption.Index;
                pawn.MarkPortraitAsDirty();
            }
        }
Пример #2
0
        public override void SelectOption(CustomPawn pawn, PawnLayerOption option)
        {
            PawnLayerOptionHair hairOption = option as PawnLayerOptionHair;

            if (hairOption != null)
            {
                pawn.Pawn.story.hairDef = hairOption.HairDef;
                pawn.MarkPortraitAsDirty();
            }
        }