PresenceParticleSpawner
File name may appear as PresenceParticleSystem.cs but the class is PresenceParticleSpawner.
Overview
UI particle system for presence/feedback effects. It has two channels:
- Money particles — pooled images that drift upward and fade.
- Severity/Control one-shots — instantiated images for Police/Cartel increase/decrease, Control gains, and personality-driven effects (tokens/loyalty/notoriety/capture).
While any severity particle is active, money particles are temporarily blocked, ensuring important feedback remains readable.
Atoms & Settings
- BoolVariable
paused - IntVariable
selectedPersonality - FloatVariable
notorietyProgress - Spawn area / interval, max pooled money particles.
- Movement: starting vertical velocity, vertical acceleration, horizontal Perlin noise (
horizontalNoise,noiseTimeScale). - Lifetime:
deathDelay(hold) +deathTime(fade). - Severity multipliers to scale lifetime & movement (applied only to severity one-shots).
- useUnscaledTime for frame-rate independent timing (UI-safe).
- forceKillGrace to hard-kill stragglers.
Prefabs
moneyPrefab,policeIncreasePrefab,cartelIncreasePrefab,policeDecreasePrefab,cartelDecreasePrefab,loyaltyPrefab,notorietyPrefab,capturePrefab,tokensPrefab.
Money Flow (pooled)
- Pool initialized on
Awake()withmaxParticles. OnEnable()immediately schedules the spawn loop.Spawn()schedules itself again after a random delay in[spawnIntervalRange.x, spawnIntervalRange.y](only counts while not paused and not money-blocked).- Each pooled particle:
- Drifts up with acceleration and horizontal noise.
- Fades after
deathDelayuntildeathTimeis reached. - Returns to pool (and can be force-killed after a safety timeout).
Severity & Control (one-shot)
- OnPoliceSeverityChange(region, isPolice, hasIncreased): spawns the matching icon near the region and runs the one-shot routine (scaled by severity multipliers).
- OnControlChange(): picks a prefab by current personality:
- Mobster →
tokensPrefab - Schemer →
notorietyPrefab(orcapturePrefabwhennotorietyProgress >= 1) - Subterfuge →
loyaltyPrefab
- Mobster →
- SpawnRewardBubbleOneShot(RewardBubble bubble): clones the bubble’s icon sprite as a one-shot particle for consistent visuals.
Money Gating
_activeSeverityCount > 0or a brief cooldown after the last severity effect prevents money spawns.- When the last severity particle ends, money is unblocked after a small randomized delay.
Spawn Points
- Random valid Region (Presence or full Control) → its
Node.visualAnchoroffset by a random vector withinspawnArea.
Disable/Reset
- On disable: stops all coroutines, hides pooled items, destroys one-shots, and clears internal counters/sets.
Notes
- Uses unscaled time for consistent UI behavior across pause states.
- Designed to be lightweight: pooling for money, instancing only for salient effects.