public override void SelectOption(CustomPawn pawn, PawnLayerOption option) { PawnLayerOptionHead headOption = option as PawnLayerOptionHead; if (headOption != null) { pawn.HeadType = headOption.HeadType; } }
public override bool IsOptionSelected(CustomPawn pawn, PawnLayerOption option) { PawnLayerOptionHead headOption = option as PawnLayerOptionHead; if (headOption == null) { return(false); } return(pawn.HeadType == headOption.HeadType); }
private List <PawnLayerOption> InitializeHeadOptions(ThingDef pawnDef, Gender gender) { List <PawnLayerOption> options = new List <PawnLayerOption>(); foreach (var headType in PrepareCarefully.Instance.Providers.HeadTypes.GetHeadTypes(pawnDef, gender)) { PawnLayerOptionHead option = new PawnLayerOptionHead(); option.HeadType = headType; options.Add(option); } return(options); }
public override int?GetSelectedIndex(CustomPawn pawn) { int selectedIndex = options.FirstIndexOf((option) => { PawnLayerOptionHead headOption = option as PawnLayerOptionHead; if (headOption == null) { return(false); } else { return(headOption.HeadType == pawn.HeadType); } }); if (selectedIndex > -1) { return(selectedIndex); } else { return(null); } }