feat: add runtime gameInfo enrichment with gameOver condition

- Add gameOverCondition to GameManager for runtime tracking
- Create enrichGameInfo() function to merge runtime condition with static gameInfo
- Add formatGameOverCondition() utility to stringify boolean/function conditions
- Returns enriched info with:
  - condition: formatted string representation
  - type: 'none' | 'static' | 'function'
- Platform can call enrichGameInfo(gameManager) to get complete game configuration
- Handles all condition types: undefined, boolean, function
- Truncates long function strings at 200 chars
This commit is contained in:
2025-11-02 17:20:21 +00:00
parent afce474e0d
commit 7b0b8ee0aa
5 changed files with 99 additions and 37 deletions
+1
View File
@@ -29,4 +29,5 @@ export type GameManager = {
hero: HeroManager;
renderer: HeroRenderManager;
scoreManager: ScoreManager;
gameOverCondition?: boolean | ((scoreManager: ScoreManager) => boolean);
} & GameStatusManager & GameKeyManager;