Add event-driven gameplay feedback framework

This commit is contained in:
2026-03-24 09:03:27 +08:00
parent 48159be900
commit 2c03d1a702
20 changed files with 1718 additions and 64 deletions

View File

@@ -1,4 +1,5 @@
import { type LonLatPoint } from '../../utils/projection'
import { type GameAudioConfig } from '../audio/audioConfig'
export type GameMode = 'classic-sequential'
export type GameControlKind = 'start' | 'control' | 'finish'
@@ -28,4 +29,5 @@ export interface GameDefinition {
punchPolicy: PunchPolicyType
controls: GameControl[]
autoFinishOnLastControl: boolean
audioConfig?: GameAudioConfig
}

View File

@@ -1,10 +1,11 @@
import { type GameSessionState } from './gameSessionState'
import { type GameSessionState, type GuidanceState } from './gameSessionState'
import { type GamePresentationState } from '../presentation/presentationState'
export type GameEffect =
| { type: 'session_started' }
| { type: 'punch_feedback'; text: string; tone: 'neutral' | 'success' | 'warning' }
| { type: 'control_completed'; controlId: string; controlKind: 'start' | 'control' | 'finish'; sequence: number | null; label: string; displayTitle: string; displayBody: string }
| { type: 'guidance_state_changed'; guidanceState: GuidanceState; controlId: string | null }
| { type: 'session_finished' }
export interface GameResult {

View File

@@ -57,6 +57,7 @@ export class GameRuntime {
currentTargetControlId: null,
inRangeControlId: null,
score: 0,
guidanceState: 'searching',
}
const result: GameResult = {
nextState: emptyState,

View File

@@ -1,4 +1,5 @@
export type GameSessionStatus = 'idle' | 'running' | 'finished' | 'failed'
export type GuidanceState = 'searching' | 'approaching' | 'ready'
export interface GameSessionState {
status: GameSessionStatus
@@ -8,4 +9,5 @@ export interface GameSessionState {
currentTargetControlId: string | null
inRangeControlId: string | null
score: number
guidanceState: GuidanceState
}