public static void ApplyAllyInteraction(IncidentDef def, StorytellerCompProperties_FactionInteraction fi) { StorytellerCompProperties_FactionInteraction comp; if (TryGetAllyInteraction(def, out comp)) { comp.minDaysPassed = fi.minDaysPassed; comp.baseIncidentsPerYear = fi.baseIncidentsPerYear; comp.minSpacingDays = fi.minSpacingDays; comp.minDaysPassed = fi.minDaysPassed; } }
private static bool TryGetAllyInteraction(IncidentDef def, out StorytellerCompProperties_FactionInteraction comp) { if (Current.Game != null && Current.Game.storyteller != null) { StorytellerDef d = Current.Game.storyteller.def; foreach (StorytellerCompProperties c in d.comps) { comp = c as StorytellerCompProperties_FactionInteraction; if (comp != null && comp.incident == def) { return(true); } } } comp = null; return(false); }