TraitManager
Overview
Loads ChairmanTrait assets from Resources/Traits\ and grants/withdraws their effects automatically when the player’s affinity tokens change. Each trait belongs to one personality track — Mobster, Schemer, or Subterfuge — and becomes obtained when floor(tokens) >= requiredTokens. Effects are applied to Unity Atoms on obtain and reverted when the threshold is no longer met. The manager also raises UI and analytics events on changes.
Serialized Atoms & Events
Global UI / notifications
FloatEvent affinityMobsterChanged,FloatEvent affinitySchemerChanged,FloatEvent affinitySubterfugeChanged— triggers for re‑evaluating traits when affinities change.VoidEvent updateTraitUI— raised after any change so UI can refresh.ChairmanTraitEvent traitObtained,ChairmanTraitEvent traitLost— fire once per trait toggle.
Mobster modifiers
FloatVariable labRefund,FloatVariable routeRefund— building & route refund multipliers.FloatVariable loyaltyLossThresholdFloatVariable eventMoneyProfitMult,FloatVariable eventMoneyCostMultFloatVariable buildingCostMultFloatVariable eventLoyaltyProfitMult,FloatVariable eventLoyaltyCostMultFloatVariable mobsterSpecialOptionFree
Schemer modifiers
FloatVariable policeSeverityGainPerTickMult,FloatVariable policeSeverityLossPerTickMultFloatVariable eventDemandCostModifier,FloatVariable eventDemandProfitModifierFloatVariable eventPoliceSeverityCostModifier,FloatVariable eventPoliceSeverityProfitModifierFloatVariable notorietyGainMult,FloatVariable captureGainMultFloatVariable schemerSpecialOptionFree
Subterfuge modifiers
FloatVariable cartelSeverityGainPerTickMult,FloatVariable cartelSeverityLossPerTickMultFloatVariable eventControlCostModifier,FloatVariable eventControlProfitModifierFloatVariable eventCartelSeverityCostModifier,FloatVariable eventCartelSeverityProfitModifierFloatVariable controlGainPerTickMult,FloatVariable controlLossPerTickMultFloatVariable subterfugeSpecialOptionFree
Data Source
Resources/Traits\is scanned on boot and eachTextAssetis parsed as a ChairmanTrait JSON object.
Lifecycle
- Awake →
LoadTraits()clears and repopulates per‑track lists. - Start → register handlers to
affinity*Changedevents. - OnDestroy → (implicit) unregister calls would go here if needed.
Affinity Change Handling
For each track:
- Compute
affinity = floor(_affinity). - For every trait in that track:
- If
affinity >= requiredTokensand not yet obtained → ApplyEffect, setobtained=true, raise traitObtained. - Else if the opposite → RevertEffect, set
obtained=false, raise traitLost.
- If
- Raise updateTraitUI.
Effect Mapping
When applying (or reverting), each ChairmanTraitEffect.Parameter adjusts a specific Atom:
| Parameter | Affected Atom(s) |
|---|---|
BUILDING_REFUND_MULT | labRefund, routeRefund |
EVENT_MONEY_PROFIT_MULT | eventMoneyProfitMult |
LOYALTY_LOSS_THRESHOLD | loyaltyLossThreshold |
EVENT_LOYALTY_COST_MULT | eventLoyaltyCostMult |
BUILDING_COST_MULT | buildingCostMult |
EVENT_MONEY_COST_MULT | eventMoneyCostMult |
EVENT_LOYALTY_PROFIT_MULT | eventLoyaltyProfitMult |
MOBSTER_SPECIAL_OPTION_FREE | mobsterSpecialOptionFree |
POLICE_SEVERITY_GAINPERTICK_MULT | policeSeverityGainPerTickMult |
EVENT_DEMAND_COST_MODIFIER | eventDemandCostModifier |
POLICE_SEVERITY_LOSSPERTICK_MULT | policeSeverityLossPerTickMult |
EVENT_POLICESEVERITY_COST_MULT | eventPoliceSeverityCostModifier |
NOTORIETY_GAIN_MULT | notorietyGainMult |
EVENT_POLICESEVERITY_PROFIT_MULT | eventPoliceSeverityProfitModifier |
CAPTURE_GAIN_MULT | captureGainMult |
EVENT_DEMAND_PROFIT_MODIFIER | eventDemandProfitModifier |
SCHEMER_SPECIAL_OPTION_FREE | schemerSpecialOptionFree |
CARTEL_SEVERITY_GAINPERTICK_MULT | cartelSeverityGainPerTickMult |
EVENT_CONTROL_COST_MULT | eventControlCostModifier |
CARTEL_SEVERITY_LOSSPERTICK_MULT | cartelSeverityLossPerTickMult |
EVENT_CARTELSEVERITY_COST_MULT | eventCartelSeverityCostModifier |
CONTROL_LOSSPERTICK_MULT | controlLossPerTickMult |
EVENT_CARTELSEVERITY_PROFIT_MULT | eventCartelSeverityProfitModifier |
CONTROL_GAIN_MULT | controlGainPerTickMult |
EVENT_CONTROL_PROFIT_MULT | eventControlProfitModifier |
SUBTERFUGE_SPECIAL_OPTION_FREE | subterfugeSpecialOptionFree |
Static API
public static List<ChairmanTrait> GetTraitList(GameManager.ChairmanPersonalities p);
// Returns the internal list for the given personality (Mobster, Schemer, Subterfuge).
Notes & Quirks
- Traits are keyed by required token thresholds using
floor(affinity); fractional progress doesn’t trigger early. - Known quirk: in the current code, reverting
EVENT_LOYALTY_PROFIT_MULTsubtracts fromeventMoneyProfitMultinstead ofeventLoyaltyProfitMult. Verify before shipping progression tuning.