Skip to content

Archived on 2026-10-24. The Godot rewrite is cancelled. Migration decisions and work checklists below are withdrawn. Original claims, code examples, file paths, and completion statements have not all been revalidated. Use the current documentation and issue register for maintenance decisions.

Unity Event And Runtime State Map

Purpose

Map static events, singleton state, runtime flags, and cross-system callbacks in the current Unity project.

Static Events And Event Buses

System Script Events / Callbacks Producers Consumers / Effects
Gameplay events Assets/Script/Game/Events/GameEvents.cs EnemyDeath(string), AchievementTrigger(string), AddDataCount(string, int), AddTarget(Enemy), RemoveTarget(Enemy) Enemy, data-count triggers, targeting systems Achievement/progression, target lists, data counters. Exact subscription map Unknown / needs manual confirmation.
Save readiness Assets/Script/App/Core/SaveManager.cs static event Action OnSaveReady Save manager initialization UI/managers that need save loaded before reading progression. Exact subscribers Unknown / needs manual confirmation.
Collection UI Assets/Script/App/UI/Buttons/CollectionButton.cs upgradeCollection, upgradeEnemies, upgradeCharacter Collection buttons Collection/detail views.
Localization Assets/Script/App/Managers/LocalizationManager.cs OnLocaleChanged(int) Locale changes Localized UI refresh.
Game state Assets/Script/Game/GameSystem/GameState/GameStateService.cs OnStateChanged(GameStateFlag, bool) GameManager/game state setters Time scale/UI systems; exact subscribers Unknown / needs manual confirmation.
Player rewards Assets/Script/Game/GameSystem/Player/PlayerManager.cs OnRewardReady(RewardType) XP/level/reward readiness RewardRoller or UI reward flow.
Enemy state UnityEvents enemy state scripts onEnterState, onActionState, onExitState, onAttackState, onDeathEvent, onTakeDamage Enemy state machines Editor-wired methods; exact wiring Unknown / needs manual confirmation.
Weapon evolution UnityEvents WeaponEvoData.cs UnityEvent<Player, float, Ability> function UpgradeFunction.WEAPONLEVELUP Editor-wired character weapon evolution methods.

Singletons And Global State

Singleton / Static Script State Held Main Dependencies
GameManager.instance GameManager.cs run state facade, pause, rerolls, players, UI references, game over/save/leaderboard hooks Almost every gameplay system references it directly or indirectly.
GameSession.Instance GameSession.cs selected level, difficulty, player count, selected characters, modifiers App/menu to gameplay scene handoff.
AbilityFunction.Instance AbilityFunction.cs ability list helpers, cooldown coroutine runner, effect/potion coroutine dictionaries AbilityHolder, UpgradeFunction, Player, PlayerWeapon, PlayerAttack.
PoolManager.Instance PoolManager.cs named object pools Spawn, attack, item, feedback, boss systems.
ResourceInitializer / resource providers ResourceInitializer.cs, related resource scripts loaded resources and config objects Game boot and UI/game data.
GameDataCount Assets/Script/Shared/GameDataCount.cs run/progression counters such as dodge rolls, reflected damage, CImpact crit count, SuperMagnet coin count Abilities, evolutions, achievements, scoring.
Save static class Assets/Script/App/Data/Save.cs static save facade/data access Save manager, progression, UI.
Audio service/resources AudioService, AudioResources audio playback and clip references GameManager, UI buttons, rewards, feedback.

GameStateService Runtime Flags

Flag Meaning Current Behavior
isPaused Manual/menu pause Set by GameManager.PauseGame, UnpauseGame, GameMenuManager.
isRewarding Reward flow active Set by reward systems. Time-scale update risk exists if state changes do not call UpdateTimeScale.
isGameOver Game over flow active Set during game over.
ShouldTimeBePaused Derived flag True when paused, rewarding, or game over.
CanPause Derived flag False during rewarding or game over.

AbilityFunction Runtime State

State Purpose Risk
Ability list references Player abilities list holds Ability asset references. Asset instances carry runtime cooldown state.
Cooldown coroutines Started per UseAbility; can be modified by cooldown multiplier and bypass flags. Shared asset/coroutine naming can make multi-player behavior hard to audit.
Coroutine key dictionary Prevents duplicate/replaces coroutines using function string plus ability string. String-keyed behavior can collide or become stale if names change.
Effect coroutine queue CallEffect and EffectCoroutine pool VFX for a duration. VFX pool growth risk.
Potion coroutine map CallPotion and PotionCoroutine manage active potion flags. Potion state timing mixed with global helper.

RewardRoller Runtime State

State Purpose Risk
Reward queue Queues RewardType values. Multiple reward sources can stack.
CurrentPhase None, Rolling, Displaying, Selecting. Selection and reroll gates depend on exact phase.
Reward pools Builds filtered candidate lists for basic/special/boss rewards. Filters rely on ability ownership, unlock state, max upgrade state, required upgrade.
Reroll amount Stored on GameManager.rerollAmount. RewardRoller.RerollUpgrade currently returns if manager.isPaused, while reward selection expects paused state in UpgradeSelection. Needs confirmation.

GameDataCount Runtime State

Counter Type Known Uses
Dodge/roll counts AbilityHolder.Dash increments dodge roll counts.
Reflected damage Player.TakeDamage/reflect abilities feed ThornArmor evolution.
CImpact crit count PlayerWeapon.AttackModify feeds CImpact evolution.
SuperMagnet coin count Collectible flow feeds SuperMagnet evolution.
Kill/score/play counters Achievements and game-over summary. Exact fields Unknown / needs manual confirmation.

Save-Ready And Progression Flow

Area Current Unity Behavior
Save init SaveManager exposes OnSaveReady after save data is loaded/prepared.
Save IO SaveService performs synchronous file reads/writes/copies.
Progression assets Achievements, characters, shop upgrades, stage unlocks, and upgrade unlocks are represented by ScriptableObject fields and save data.
Game over GameManager.GameOver updates counters/achievements/saves and may post leaderboard data.
Risk Save/progression state and asset fields overlap. Exact source of truth for each unlock is Unknown / needs manual confirmation.

Problems / Risks

  • Static events and singletons make call order and subscription lifetime hard to audit.
  • Runtime flags exist both in dedicated services and in large scripts.
  • Some time-scale behavior depends on whether state setters also update Time.timeScale.
  • UnityEvents hide important weapon/evolution/enemy behavior in scene or asset wiring.
  • Save-ready flow can make UI/progression order fragile if consumers read before event delivery.

Open Questions

  • Which scripts subscribe to each static GameEvents event at runtime?
  • Are UnityEvent links fully represented in source control assets, or only in scenes/prefabs?
  • Which save/progression values are authoritative when they conflict with ScriptableObject fields?
  • Unknown / needs manual confirmation.