public void ClickRecipeAction(ImplantRecipe recipe) { if (recipe.Disabled && !recipe.Selected) { return; } SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(); if (recipe.Selected) { recipe.Selected = false; foreach (var part in recipe.Parts) { if (part.Selected) { part.Selected = false; RemoveImplant(recipe, part); } } } else { recipe.Selected = true; if (recipe.Parts.Count == 1) { recipe.Parts[0].Selected = true; AddImplant(recipe, recipe.Parts[0]); } } MarkDisabledOptionsAsDirty(); }
protected void RemoveImplant(ImplantRecipe recipe, ImplantBodyPart part) { if (part.Implant != null) { implantList.Remove(part.Implant); part.Implant = null; } }
protected void AddImplant(ImplantRecipe recipe, ImplantBodyPart part) { Implant implant = new Implant(); implant.recipe = recipe.Recipe; implant.BodyPartRecord = part.Part; implantList.Add(implant); part.Implant = implant; }
public void ClickPartAction(ImplantRecipe recipe, ImplantBodyPart part) { if (part.Disabled && !part.Selected) { return; } SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(); if (part.Selected) { part.Selected = false; RemoveImplant(recipe, part); } else { part.Selected = true; AddImplant(recipe, part); } MarkDisabledOptionsAsDirty(); }