Region
Overview
Core per-area simulation unit. Tracks severity (Police/Cartel), Control, Demand/Supply, and building state (Laboratory and Distribution Spot). Subscribes to the global tick and advances severity/control over time depending on presence and supply vs demand. Raises UI and analytics events on key changes and exposes helpers to add/remove/upgrade infrastructure.
Serialized Atoms & Data
- Per‑tick base rates:
controlGainPerTick,controlLossPerTick,severityPoliceGainPerTick,severityPoliceLossPerTick,severityCriminalGainPerTick,severityCriminalLossPerTick - Multipliers:
controlGainPerTickMult,controlLossPerTickMult,severityPoliceGainPerTickMult,severityPoliceLossPerTickMult,severityCriminalGainPerTickMult,severityCriminalLossPerTickMult - Economy & upgrade:
currentMoney,LabUpgradeCostTable upgradeLabCostTable,labCost,labRefund,labCount - Selection/UI:
RegionVariable selectedRegion,VoidEvent updateRegionUI - Progression:
totalRegionsSecured - Personality/Affinity:
selectedPersonality,schemerNotorietyLossOnControlled,subterfugeLoyaltyGainOnControlled,mobsterAffinityGainOnControlled,affinityMobster,affinitySchemer,affinitySubterfuge,loyalty,notorietyProgress,captureProgress,schemerSeverityOverflowMult - Events:
labAddedEvent,routeAddedEvent,regionSecured - Prefabs:
labPrefab,localLabPrefab(Distribution Spot),routePrefab - UI: biome enum,
PresenceParticleSpawner,Image labIcon, sprites for lab levels and Distribution Spot
Runtime Properties
LocalDemand,LocalProduction(fromregionLab.TotalProduction),PoliceSeverity,CartelSeverity,SupplyPerTick,Control,Presence,OverSupply,RegionName,RegionLab,RegionLocalLab,Biome
Tick Behavior
- If presence this tick:
- If not secured:
- Normal flow (not Schemer or supply ≤ demand): increase Police/Cartel severity by gain×mult (clamped to 1), fire severity band VFX if crossing thresholds, increase Control by gain×mult; when
Control ≥ 1:- Call
OnControlGained(), raiseregionSecured, mark secured, and auto‑add a Distribution Spot if there is no Lab/Spot.
- Call
- Schemer overflow (Schemer and supply > demand): dampen severity gains by
(1 - (supply - demand) * schemerSeverityOverflowMult)and apply, firing VFX on band changes.
- Normal flow (not Schemer or supply ≤ demand): increase Police/Cartel severity by gain×mult (clamped to 1), fire severity band VFX if crossing thresholds, increase Control by gain×mult; when
- If not secured:
- If no presence and not secured: decay severities by loss×mult to their minimums and reduce Control by loss×mult to
0. - Always: update region icon UI, set
OverSupply = SupplyPerTick > LocalDemand, raiseupdateRegionUIif this region is selected, then resetSupplyPerTick = 0andPresence = false. fileciteturn15file2
Severity Bands
- Static thresholds: Low < 0.35 ≤ Mid < 0.8 ≤ High. Crossing into a new band triggers
PresenceParticleSpawner.OnPoliceSeverityChange(...). fileciteturn15file2
Control Gained Effects
When Control reaches 1 for the first time:
- Mobster: randomly splits
mobsterAffinityGainOnControlledinto three non‑negative integers and adds them to Mobster/Schemer/Subterfuge affinities. - Schemer: reduces Notoriety (or Capture if Notoriety is full) by
schemerNotorietyLossOnControlled. - Subterfuge: increases Loyalty by
subterfugeLoyaltyGainOnControlled. Also incrementstotalRegionsSecuredand callsPresenceParticleSpawner.OnControlChange(). fileciteturn15file2
Localization
GetLocalizedName() returns I2 key "REGION_" + name (uppercase with underscores). SelectRegion() writes itself into selectedRegion (raising change). fileciteturn15file2
Infrastructure API
- Distribution Spot
AddLocaLab()— instantiates the Distribution Spot prefab, assigns.region = this, and refreshes UI.RemoveLocalLab()— destroys the Spot and refreshes UI.
- Laboratory
AddLaboratory()— removes Distribution Spot if present, instantiates a Lab, assigns.region = this, updates icon, and raiseslabAddedEvent.RemoveLaboratory(bool refund)— removes all routes, updates counts and costs, optionally refunds, restores Distribution Spot if secured, and refreshes UI.UpgradeLab()—BaseProduction += 0.5f, spend cost fromupgradeLabCostTableat the current level,UpgradeLevel++,UpdateSupply(), update icon, refresh UI. fileciteturn15file2
Routes
AddRoute(List<Node> routeNodes)— instantiates a Route under the Lab, initializes it with the node path, registers it in the Lab, raisesrouteAddedEvent, and refreshes UI.HasRouteToNode(Node dest)— returnstrueif any Lab route already targets the given node’s Region. fileciteturn15file2
Save/Load
SaveKey=gameObject.name.Save()→ DTO with demand, min/current severities, and control.Load(dto, updateUI)→ applies DTO (by key/name match), optionally updates icon and raises UI if selected, and marksloadedData=true. fileciteturn15file2