com.amanotes.magictilescore 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +240 -0
- package/CHANGELOG.md.meta +7 -0
- package/Docs/Class-Hierarchy.md +729 -0
- package/Docs/Class-Hierarchy.md.meta +7 -0
- package/Docs/Component-Architecture.md +43 -0
- package/Docs/Component-Architecture.md.meta +7 -0
- package/Docs/File-Structure.md +327 -0
- package/Docs/File-Structure.md.meta +7 -0
- package/Docs/Game-Architecture.md +41 -0
- package/Docs/Game-Architecture.md.meta +7 -0
- package/Docs/Input-System-Guide.md +419 -0
- package/Docs/Input-System-Guide.md.meta +7 -0
- package/Docs/Knot-System-Guide.md +309 -0
- package/Docs/Knot-System-Guide.md.meta +7 -0
- package/Docs/Meta-System-Guide.md +249 -0
- package/Docs/Meta-System-Guide.md.meta +7 -0
- package/Docs/New-Game-Checklist.md +102 -0
- package/Docs/New-Game-Checklist.md.meta +7 -0
- package/Docs/README.md +37 -0
- package/Docs/README.md.meta +7 -0
- package/Docs/RhythmCore-Architecture.md +373 -0
- package/Docs/RhythmCore-Architecture.md.meta +7 -0
- package/Docs/RhythmCore-Customize-Guide.md +391 -0
- package/Docs/RhythmCore-Customize-Guide.md.meta +7 -0
- package/Docs/Understanding-Rhythm-Core.md +483 -0
- package/Docs/Understanding-Rhythm-Core.md.meta +7 -0
- package/Docs/VisualWarp-System-Guide.md +377 -0
- package/Docs/VisualWarp-System-Guide.md.meta +7 -0
- package/Docs/Widget2D-System-Guide.md +450 -0
- package/Docs/Widget2D-System-Guide.md.meta +7 -0
- package/Docs.meta +8 -0
- package/Editor/AdjustHueEditor.cs +90 -0
- package/Editor/AdjustHueEditor.cs.meta +11 -0
- package/Editor/ClassInstanceDrawer.cs +256 -0
- package/Editor/ClassInstanceDrawer.cs.meta +11 -0
- package/Editor/CollapsibleGroupEditor.cs +142 -0
- package/Editor/CollapsibleGroupEditor.cs.meta +11 -0
- package/Editor/ListSongNoteEditor.cs +317 -0
- package/Editor/ListSongNoteEditor.cs.meta +11 -0
- package/Editor/MagicTilesCore.Editor.asmdef +20 -0
- package/Editor/MagicTilesCore.Editor.asmdef.meta +7 -0
- package/Editor/MetaLogicDrawer.cs +488 -0
- package/Editor/MetaLogicDrawer.cs.meta +11 -0
- package/Editor/RhythmContextEditor.EditorDrawer.cs +46 -0
- package/Editor/RhythmContextEditor.EditorDrawer.cs.meta +3 -0
- package/Editor/RhythmContextEditor.cs +587 -0
- package/Editor/RhythmContextEditor.cs.meta +3 -0
- package/Editor/RhythmGameEditor.cs +45 -0
- package/Editor/RhythmGameEditor.cs.meta +11 -0
- package/Editor/RhythmTileEditor.cs +93 -0
- package/Editor/RhythmTileEditor.cs.meta +11 -0
- package/Editor/TagConfigDrawer.cs +30 -0
- package/Editor/TagConfigDrawer.cs.meta +11 -0
- package/Editor.meta +8 -0
- package/LICENSE.md +7 -0
- package/LICENSE.md.meta +7 -0
- package/README.md +88 -0
- package/README.md.meta +7 -0
- package/Runtime/AssemblyInfo.cs +4 -0
- package/Runtime/AssemblyInfo.cs.meta +11 -0
- package/Runtime/Input/Base/BaseTileInput.cs +44 -0
- package/Runtime/Input/Base/BaseTileInput.cs.meta +11 -0
- package/Runtime/Input/Base/IInputHandler.cs +11 -0
- package/Runtime/Input/Base/IInputHandler.cs.meta +11 -0
- package/Runtime/Input/Base/InputData.cs +94 -0
- package/Runtime/Input/Base/InputData.cs.meta +3 -0
- package/Runtime/Input/Base/InputDirection.cs +17 -0
- package/Runtime/Input/Base/InputDirection.cs.meta +3 -0
- package/Runtime/Input/Base/InputPhase.cs +4 -0
- package/Runtime/Input/Base/InputPhase.cs.meta +3 -0
- package/Runtime/Input/Base.meta +3 -0
- package/Runtime/Input/Components/DragInput.cs +44 -0
- package/Runtime/Input/Components/DragInput.cs.meta +11 -0
- package/Runtime/Input/Components/HoldInput.cs +75 -0
- package/Runtime/Input/Components/HoldInput.cs.meta +12 -0
- package/Runtime/Input/Components/SwipeInput.cs +45 -0
- package/Runtime/Input/Components/SwipeInput.cs.meta +12 -0
- package/Runtime/Input/Components/TouchInput.cs +31 -0
- package/Runtime/Input/Components/TouchInput.cs.meta +11 -0
- package/Runtime/Input/Components.meta +8 -0
- package/Runtime/Input.meta +8 -0
- package/Runtime/MagicTilesCore.asmdef +24 -0
- package/Runtime/MagicTilesCore.asmdef.meta +7 -0
- package/Runtime/MoodChange/AdjustHue.ComponentInfo.cs +12 -0
- package/Runtime/MoodChange/AdjustHue.ComponentInfo.cs.meta +3 -0
- package/Runtime/MoodChange/AdjustHue.MaterialInfo.cs +115 -0
- package/Runtime/MoodChange/AdjustHue.MaterialInfo.cs.meta +3 -0
- package/Runtime/MoodChange/AdjustHue.ParticleSystemInfo.cs +36 -0
- package/Runtime/MoodChange/AdjustHue.ParticleSystemInfo.cs.meta +3 -0
- package/Runtime/MoodChange/AdjustHue.SpriteRendererInfo.cs +28 -0
- package/Runtime/MoodChange/AdjustHue.SpriteRendererInfo.cs.meta +3 -0
- package/Runtime/MoodChange/AdjustHue.TrailRendererInfo.cs +37 -0
- package/Runtime/MoodChange/AdjustHue.TrailRendererInfo.cs.meta +3 -0
- package/Runtime/MoodChange/AdjustHue.cs +219 -0
- package/Runtime/MoodChange/AdjustHue.cs.meta +11 -0
- package/Runtime/MoodChange/ColorHueExtensions.cs +227 -0
- package/Runtime/MoodChange/ColorHueExtensions.cs.meta +3 -0
- package/Runtime/MoodChange/HueCache.cs +167 -0
- package/Runtime/MoodChange/HueCache.cs.meta +11 -0
- package/Runtime/MoodChange/MoodChange.cs +52 -0
- package/Runtime/MoodChange/MoodChange.cs.meta +3 -0
- package/Runtime/MoodChange.meta +3 -0
- package/Runtime/Physics/TriggerCallback.cs +21 -0
- package/Runtime/Physics/TriggerCallback.cs.meta +3 -0
- package/Runtime/Physics.meta +8 -0
- package/Runtime/Preset/AudioSourcePlayer/AudioSourcePlayer.cs +153 -0
- package/Runtime/Preset/AudioSourcePlayer/AudioSourcePlayer.cs.meta +11 -0
- package/Runtime/Preset/AudioSourcePlayer/AudioSourcePlayer.prefab +145 -0
- package/Runtime/Preset/AudioSourcePlayer/AudioSourcePlayer.prefab.meta +7 -0
- package/Runtime/Preset/AudioSourcePlayer.meta +8 -0
- package/Runtime/Preset/AudioTimeText/AudioTimeText.cs +22 -0
- package/Runtime/Preset/AudioTimeText/AudioTimeText.cs.meta +11 -0
- package/Runtime/Preset/AudioTimeText/AudioTimeText.prefab +188 -0
- package/Runtime/Preset/AudioTimeText/AudioTimeText.prefab.meta +7 -0
- package/Runtime/Preset/AudioTimeText.meta +8 -0
- package/Runtime/Preset/ParticleSystemPlayer/ParticleSystemPlayer.cs +32 -0
- package/Runtime/Preset/ParticleSystemPlayer/ParticleSystemPlayer.cs.meta +11 -0
- package/Runtime/Preset/ParticleSystemPlayer.meta +8 -0
- package/Runtime/Preset/RendererAlpha.cs +56 -0
- package/Runtime/Preset/RendererAlpha.cs.meta +11 -0
- package/Runtime/Preset/ScoreText/ScoreText.anim +198 -0
- package/Runtime/Preset/ScoreText/ScoreText.anim.meta +8 -0
- package/Runtime/Preset/ScoreText/ScoreText.cs +32 -0
- package/Runtime/Preset/ScoreText/ScoreText.cs.meta +11 -0
- package/Runtime/Preset/ScoreText/ScoreText_2D.prefab +170 -0
- package/Runtime/Preset/ScoreText/ScoreText_2D.prefab.meta +7 -0
- package/Runtime/Preset/ScoreText/ScoreText_3D.prefab +206 -0
- package/Runtime/Preset/ScoreText/ScoreText_3D.prefab.meta +7 -0
- package/Runtime/Preset/ScoreText.meta +8 -0
- package/Runtime/Preset/StartHint/StartHint.cs +26 -0
- package/Runtime/Preset/StartHint/StartHint.cs.meta +3 -0
- package/Runtime/Preset/StartHint.meta +8 -0
- package/Runtime/Preset/WowText/WowText.cs +38 -0
- package/Runtime/Preset/WowText/WowText.cs.meta +3 -0
- package/Runtime/Preset/WowText.meta +8 -0
- package/Runtime/Preset.meta +8 -0
- package/Runtime/Rhythm/Components/Controls.meta +8 -0
- package/Runtime/Rhythm/Components/Helper/CameraFollow.cs +28 -0
- package/Runtime/Rhythm/Components/Helper/CameraFollow.cs.meta +11 -0
- package/Runtime/Rhythm/Components/Helper/MeshSpriteSorter.cs +89 -0
- package/Runtime/Rhythm/Components/Helper/MeshSpriteSorter.cs.meta +11 -0
- package/Runtime/Rhythm/Components/Helper/RecycleLayoutZ.cs +74 -0
- package/Runtime/Rhythm/Components/Helper/RecycleLayoutZ.cs.meta +11 -0
- package/Runtime/Rhythm/Components/Helper.meta +8 -0
- package/Runtime/Rhythm/Components.meta +8 -0
- package/Runtime/Rhythm/Core/GameMode.cs +10 -0
- package/Runtime/Rhythm/Core/GameMode.cs.meta +3 -0
- package/Runtime/Rhythm/Core/IAudioPlayer.cs +16 -0
- package/Runtime/Rhythm/Core/IAudioPlayer.cs.meta +3 -0
- package/Runtime/Rhythm/Core/IRhythmBehaviour.cs +10 -0
- package/Runtime/Rhythm/Core/IRhythmBehaviour.cs.meta +3 -0
- package/Runtime/Rhythm/Core/RhythmBehaviour.cs +57 -0
- package/Runtime/Rhythm/Core/RhythmBehaviour.cs.meta +11 -0
- package/Runtime/Rhythm/Core/RhythmDebug.cs +48 -0
- package/Runtime/Rhythm/Core/RhythmDebug.cs.meta +11 -0
- package/Runtime/Rhythm/Core/RhythmGameT.cs +323 -0
- package/Runtime/Rhythm/Core/RhythmGameT.cs.meta +3 -0
- package/Runtime/Rhythm/Core/RhythmMatch.cs +65 -0
- package/Runtime/Rhythm/Core/RhythmMatch.cs.meta +11 -0
- package/Runtime/Rhythm/Core/RhythmTile.cs +77 -0
- package/Runtime/Rhythm/Core/RhythmTile.cs.meta +3 -0
- package/Runtime/Rhythm/Core/RhythmTileHandler.cs +59 -0
- package/Runtime/Rhythm/Core/RhythmTileHandler.cs.meta +3 -0
- package/Runtime/Rhythm/Core.meta +8 -0
- package/Runtime/Rhythm/Extensions/CollectionExtensions.cs +120 -0
- package/Runtime/Rhythm/Extensions/CollectionExtensions.cs.meta +11 -0
- package/Runtime/Rhythm/Extensions/ColliderExtensions.cs +27 -0
- package/Runtime/Rhythm/Extensions/ColliderExtensions.cs.meta +11 -0
- package/Runtime/Rhythm/Extensions/GameHandlerExtensions.cs +56 -0
- package/Runtime/Rhythm/Extensions/GameHandlerExtensions.cs.meta +11 -0
- package/Runtime/Rhythm/Extensions/GameObjectExtensions.cs +61 -0
- package/Runtime/Rhythm/Extensions/GameObjectExtensions.cs.meta +11 -0
- package/Runtime/Rhythm/Extensions/InputDirectionExtensions.cs +76 -0
- package/Runtime/Rhythm/Extensions/InputDirectionExtensions.cs.meta +11 -0
- package/Runtime/Rhythm/Extensions/MTCListExtensions.cs +127 -0
- package/Runtime/Rhythm/Extensions/MTCListExtensions.cs.meta +11 -0
- package/Runtime/Rhythm/Extensions/MeshRendererExtensions.cs +81 -0
- package/Runtime/Rhythm/Extensions/MeshRendererExtensions.cs.meta +11 -0
- package/Runtime/Rhythm/Extensions/ParticleSystemExtensions.cs +54 -0
- package/Runtime/Rhythm/Extensions/ParticleSystemExtensions.cs.meta +11 -0
- package/Runtime/Rhythm/Extensions.meta +8 -0
- package/Runtime/Rhythm/Game/MTCSongAutoStart.cs +40 -0
- package/Runtime/Rhythm/Game/MTCSongAutoStart.cs.meta +11 -0
- package/Runtime/Rhythm/Game/RhythmConfig.cs +68 -0
- package/Runtime/Rhythm/Game/RhythmConfig.cs.meta +11 -0
- package/Runtime/Rhythm/Game/RhythmContext.Api.cs +533 -0
- package/Runtime/Rhythm/Game/RhythmContext.Api.cs.meta +11 -0
- package/Runtime/Rhythm/Game/RhythmContext.Dev.cs +121 -0
- package/Runtime/Rhythm/Game/RhythmContext.Dev.cs.meta +11 -0
- package/Runtime/Rhythm/Game/RhythmContext.Initialization.cs +114 -0
- package/Runtime/Rhythm/Game/RhythmContext.Initialization.cs.meta +11 -0
- package/Runtime/Rhythm/Game/RhythmContext.Runtime.cs +126 -0
- package/Runtime/Rhythm/Game/RhythmContext.Runtime.cs.meta +11 -0
- package/Runtime/Rhythm/Game/RhythmContext.State.cs +221 -0
- package/Runtime/Rhythm/Game/RhythmContext.State.cs.meta +11 -0
- package/Runtime/Rhythm/Game/RhythmContext.Tile.cs +90 -0
- package/Runtime/Rhythm/Game/RhythmContext.Tile.cs.meta +11 -0
- package/Runtime/Rhythm/Game/RhythmContext.TimeMachine.cs +315 -0
- package/Runtime/Rhythm/Game/RhythmContext.TimeMachine.cs.meta +11 -0
- package/Runtime/Rhythm/Game/RhythmContext.cs +312 -0
- package/Runtime/Rhythm/Game/RhythmContext.cs.meta +11 -0
- package/Runtime/Rhythm/Game/RhythmContextExtensions.cs +91 -0
- package/Runtime/Rhythm/Game/RhythmContextExtensions.cs.meta +11 -0
- package/Runtime/Rhythm/Game/Tile/ITileProgress.cs +7 -0
- package/Runtime/Rhythm/Game/Tile/ITileProgress.cs.meta +3 -0
- package/Runtime/Rhythm/Game/Tile/TileContext.cs +194 -0
- package/Runtime/Rhythm/Game/Tile/TileContext.cs.meta +11 -0
- package/Runtime/Rhythm/Game/Tile.meta +3 -0
- package/Runtime/Rhythm/Game.meta +3 -0
- package/Runtime/Rhythm/Math/Parabol.cs +35 -0
- package/Runtime/Rhythm/Math/Parabol.cs.meta +11 -0
- package/Runtime/Rhythm/Math.meta +8 -0
- package/Runtime/Rhythm/System/Event/GameEvent.cs +82 -0
- package/Runtime/Rhythm/System/Event/GameEvent.cs.meta +3 -0
- package/Runtime/Rhythm/System/Event.meta +8 -0
- package/Runtime/Rhythm/System/Meta/MetaLogic.cs +121 -0
- package/Runtime/Rhythm/System/Meta/MetaLogic.cs.meta +11 -0
- package/Runtime/Rhythm/System/Meta/VisualSpeedMeta.cs +132 -0
- package/Runtime/Rhythm/System/Meta/VisualSpeedMeta.cs.meta +11 -0
- package/Runtime/Rhythm/System/Meta.meta +8 -0
- package/Runtime/Rhythm/System/SongData/ListSongNote.cs +45 -0
- package/Runtime/Rhythm/System/SongData/ListSongNote.cs.meta +3 -0
- package/Runtime/Rhythm/System/SongData.meta +8 -0
- package/Runtime/Rhythm/System/StateMachine/RhythmStateMachine.State.cs +22 -0
- package/Runtime/Rhythm/System/StateMachine/RhythmStateMachine.State.cs.meta +11 -0
- package/Runtime/Rhythm/System/StateMachine/RhythmStateMachine.cs +138 -0
- package/Runtime/Rhythm/System/StateMachine/RhythmStateMachine.cs.meta +11 -0
- package/Runtime/Rhythm/System/StateMachine.meta +8 -0
- package/Runtime/Rhythm/System/TimeKnot/ListTimeKnots.cs +135 -0
- package/Runtime/Rhythm/System/TimeKnot/ListTimeKnots.cs.meta +11 -0
- package/Runtime/Rhythm/System/TimeKnot.meta +8 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeInterpolator.cs +365 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeInterpolator.cs.meta +11 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeMarker.cs +107 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeMarker.cs.meta +3 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeNode.cs +14 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeNode.cs.meta +3 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeSpanNode.cs +21 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeSpanNode.cs.meta +3 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.ZLaneSpeed.cs +28 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.ZLaneSpeed.cs.meta +3 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.cs +131 -0
- package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.cs.meta +11 -0
- package/Runtime/Rhythm/System/TimeMachine.meta +8 -0
- package/Runtime/Rhythm/System/VisualKnot/VisualKnotLogic.cs +160 -0
- package/Runtime/Rhythm/System/VisualKnot/VisualKnotLogic.cs.meta +11 -0
- package/Runtime/Rhythm/System/VisualKnot.meta +8 -0
- package/Runtime/Rhythm/System/VisualWarp/IVisualWarp.cs +10 -0
- package/Runtime/Rhythm/System/VisualWarp/IVisualWarp.cs.meta +11 -0
- package/Runtime/Rhythm/System/VisualWarp/LinearVisualWarp.cs +27 -0
- package/Runtime/Rhythm/System/VisualWarp/LinearVisualWarp.cs.meta +11 -0
- package/Runtime/Rhythm/System/VisualWarp.meta +8 -0
- package/Runtime/Rhythm/System.meta +8 -0
- package/Runtime/Rhythm.meta +8 -0
- package/Runtime.meta +8 -0
- package/package.json +12 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,729 @@
|
|
|
1
|
+
# MagicTilesCore - Complete Class Hierarchy
|
|
2
|
+
|
|
3
|
+
**Package:** `com.amanotes.magictilescore`
|
|
4
|
+
**Version:** 0.4.0
|
|
5
|
+
**Generated:** 2026-01-22 (from source code analysis)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Core Architecture
|
|
10
|
+
|
|
11
|
+
### Game Layer (Your Implementation)
|
|
12
|
+
```
|
|
13
|
+
MonoBehaviour
|
|
14
|
+
└── RhythmGame (abstract)
|
|
15
|
+
└── RhythmGameT<TSongNote, TMatchData> (generic base)
|
|
16
|
+
└── YourGame (e.g., MT3Game, DRGame, THGame)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Role:** Main game controller - inherit this to create your game
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Framework Classes
|
|
24
|
+
|
|
25
|
+
### 1. RhythmCore (Runtime/Rhythm/Core/)
|
|
26
|
+
|
|
27
|
+
#### RhythmGame (abstract)
|
|
28
|
+
**File:** `RhythmGameT.cs`
|
|
29
|
+
**Role:** Base game class - lifecycle, tile spawning, miss handling
|
|
30
|
+
**Key Methods:**
|
|
31
|
+
- `CreateMatchData()` - Create scoring system
|
|
32
|
+
- `CreateRhythmTile(note)` - Get tile from pool
|
|
33
|
+
- `CheckMissedNote()` - Miss detection
|
|
34
|
+
- `HandleMissedTile()` - Miss response
|
|
35
|
+
- `DieNoteSequence()` - Death/revive flow
|
|
36
|
+
|
|
37
|
+
#### RhythmTile (abstract)
|
|
38
|
+
**File:** `RhythmTile.cs`
|
|
39
|
+
**Role:** Base tile visual component
|
|
40
|
+
**Key Members:**
|
|
41
|
+
- `RhythmContext context` - Game context
|
|
42
|
+
- `TileContext tileContext` - Tile data
|
|
43
|
+
- `List<RhythmTileHandler> handlers` - Sub-components
|
|
44
|
+
**Key Methods:**
|
|
45
|
+
- `OnAttach()` - Setup when spawned
|
|
46
|
+
- `OnDetach()` - Cleanup when despawned
|
|
47
|
+
- `RefreshTileStatus()` - Update visuals based on status
|
|
48
|
+
|
|
49
|
+
#### RhythmMatch
|
|
50
|
+
**File:** `RhythmMatch.cs`
|
|
51
|
+
**Role:** Scoring system base class
|
|
52
|
+
**Key Methods:**
|
|
53
|
+
- `Init(RhythmContext)` - Initialize
|
|
54
|
+
- `CalculateScore(TileContext)` - Score calculation
|
|
55
|
+
- `OnTileMissed(TileContext)` - Miss handling
|
|
56
|
+
- `Reset()` - Clear score data
|
|
57
|
+
|
|
58
|
+
#### RhythmBehaviour
|
|
59
|
+
**File:** `RhythmBehaviour.cs`
|
|
60
|
+
**Role:** Base MonoBehaviour with context access
|
|
61
|
+
**Implements:** `IRhythmBehaviour`
|
|
62
|
+
|
|
63
|
+
#### Key Interfaces
|
|
64
|
+
- **IRhythmBehaviour** - Context-aware component interface
|
|
65
|
+
- **IAudioPlayer** - Audio system interface
|
|
66
|
+
- **IVisualWarp** - 3D transformation interface (for curved games)
|
|
67
|
+
- **ITileProgress** - Long tile progress tracking interface
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### 2. RhythmGame Layer (Runtime/Rhythm/Game/)
|
|
72
|
+
|
|
73
|
+
#### RhythmContext (ScriptableObject)
|
|
74
|
+
**Files:** `RhythmContext.cs` (+ 7 partial files)
|
|
75
|
+
**Role:** Central coordinator - connects all systems
|
|
76
|
+
**Key Members:**
|
|
77
|
+
```csharp
|
|
78
|
+
// Configuration
|
|
79
|
+
RhythmConfig config
|
|
80
|
+
ListSongNote songNotes
|
|
81
|
+
RhythmMatch matchData
|
|
82
|
+
|
|
83
|
+
// Systems
|
|
84
|
+
RhythmStateMachine stateMachine
|
|
85
|
+
VisualKnotLogic visualKnotLogic
|
|
86
|
+
MTCTimeMachine timeMachine (internal via gameTime property)
|
|
87
|
+
IVisualWarp visualWarp
|
|
88
|
+
|
|
89
|
+
// Pooling
|
|
90
|
+
IPrefabPool prefabPool
|
|
91
|
+
PoolGroup tilePoolGroup
|
|
92
|
+
PoolGroup vfxPoolGroup
|
|
93
|
+
|
|
94
|
+
// Timing
|
|
95
|
+
float gameTime // Current game time
|
|
96
|
+
float audioTime // Audio playback time
|
|
97
|
+
float visualSpeed // Tile movement speed
|
|
98
|
+
float audioSpeed // Playback speed multiplier
|
|
99
|
+
|
|
100
|
+
// State
|
|
101
|
+
string GameState // Current state (GAME_READY, GAME_START, etc.)
|
|
102
|
+
bool IsPlaying // Is game active
|
|
103
|
+
bool IsRewinding // Is rewinding
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Key Methods:**
|
|
107
|
+
```csharp
|
|
108
|
+
// Lifecycle
|
|
109
|
+
Init() -> Prepare() -> Ready() -> StartGame()
|
|
110
|
+
PauseGame() / ResumeGame()
|
|
111
|
+
DieGame() -> RewindToNote() -> ReviveGame()
|
|
112
|
+
StopGame() -> Shutdown()
|
|
113
|
+
|
|
114
|
+
// State machine
|
|
115
|
+
bool CanTransitionTo(string state)
|
|
116
|
+
string GameState { get; set; }
|
|
117
|
+
|
|
118
|
+
// Timing
|
|
119
|
+
float GetDistanceAtTime(float time)
|
|
120
|
+
float GetTimeAtDistance(float distance)
|
|
121
|
+
float GetTimeDistanceToNote(SongNote note)
|
|
122
|
+
|
|
123
|
+
// Warping (3D games)
|
|
124
|
+
(Vector3 position, Quaternion rotation) GetWarped(float time, float lane)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**State Machine:** See mermaid state diagram in `RhythmCore-Customize-Guide.md`
|
|
128
|
+
|
|
129
|
+
#### RhythmConfig (ScriptableObject)
|
|
130
|
+
**File:** `RhythmConfig.cs`
|
|
131
|
+
**Role:** Configuration asset
|
|
132
|
+
**Key Fields:**
|
|
133
|
+
```csharp
|
|
134
|
+
// Timing
|
|
135
|
+
float mp3Offset
|
|
136
|
+
float touchLatency
|
|
137
|
+
float deviceAudioLatency
|
|
138
|
+
float gameDepartTime // Start time offset
|
|
139
|
+
float endingBufferTime // End buffer
|
|
140
|
+
float loopPrepareTime // Loop preparation time
|
|
141
|
+
float rewindingDuration // Rewind animation time
|
|
142
|
+
|
|
143
|
+
// Visual
|
|
144
|
+
float visualSpeed // Base tile speed
|
|
145
|
+
float zUnitDistance // Distance unit
|
|
146
|
+
|
|
147
|
+
// Layout
|
|
148
|
+
int nLanes // Number of lanes
|
|
149
|
+
float laneWidth // Width per lane
|
|
150
|
+
|
|
151
|
+
// Pooling
|
|
152
|
+
PoolGroup tilePoolGroup // Tile prefabs
|
|
153
|
+
PoolGroup vfxPoolGroup // VFX prefabs
|
|
154
|
+
|
|
155
|
+
// Behavior
|
|
156
|
+
bool isAutoRewind // Auto rewind on death
|
|
157
|
+
List<string> excludeFromAutoPlay // Types to skip in auto-play
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### TileContext (sealed class)
|
|
161
|
+
**File:** `Game/Tile/TileContext.cs`
|
|
162
|
+
**Role:** Data bridge between note data and visual tile
|
|
163
|
+
**Key Members:**
|
|
164
|
+
```csharp
|
|
165
|
+
readonly int index
|
|
166
|
+
readonly SongNote note
|
|
167
|
+
readonly RhythmContext context
|
|
168
|
+
readonly float slideLength
|
|
169
|
+
readonly List<VisualKnot> knots // Knots for this tile
|
|
170
|
+
|
|
171
|
+
TileStatus Status // None, Touching, End, Missed
|
|
172
|
+
float progress // 0-1 for long tiles
|
|
173
|
+
float accuracy // Hit accuracy
|
|
174
|
+
RhythmTile view // Visual component
|
|
175
|
+
|
|
176
|
+
float FillingProgress // Visual fill progress
|
|
177
|
+
float GetKnotProgressAtTime(float time) // Knot-based progress
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Methods:**
|
|
181
|
+
```csharp
|
|
182
|
+
TileContext AttachView() // Spawn visual
|
|
183
|
+
void RemoveView() // Despawn visual
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### TileStatus (enum)
|
|
187
|
+
```csharp
|
|
188
|
+
None // Not touched yet
|
|
189
|
+
Touching // Being touched
|
|
190
|
+
End // Touch completed
|
|
191
|
+
Missed // Missed/failed
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### 3. System Layer (Runtime/Rhythm/System/)
|
|
197
|
+
|
|
198
|
+
#### MTCTimeMachine
|
|
199
|
+
**Files:** `TimeMachine/MTCTimeMachine.cs` (+ 4 partial files)
|
|
200
|
+
**Role:** Time-based event system & distance conversion
|
|
201
|
+
|
|
202
|
+
**Key Methods:**
|
|
203
|
+
```csharp
|
|
204
|
+
float currentTime { get; set; } // Seek to time
|
|
205
|
+
|
|
206
|
+
// Event system
|
|
207
|
+
void Add(TimeNode node) // Add time-triggered event
|
|
208
|
+
void Add(TimeSpanNode node) // Add duration-based event
|
|
209
|
+
void Sort() // Sort events by time
|
|
210
|
+
void PreExecuteActiveNodes() // Execute active events
|
|
211
|
+
|
|
212
|
+
// Cleanup
|
|
213
|
+
void Reset() // Reset to time 0
|
|
214
|
+
void ResetAndClear() // Clear all events
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Sub-classes:**
|
|
218
|
+
- `TimeNode` - Single time trigger
|
|
219
|
+
- `TimeSpanNode` - Time range trigger
|
|
220
|
+
- `TimeMarker` - Named time point
|
|
221
|
+
- `ZLaneSpeed` - Lane-specific speed (MT3)
|
|
222
|
+
|
|
223
|
+
**Usage:**
|
|
224
|
+
```csharp
|
|
225
|
+
// In RhythmContext
|
|
226
|
+
context.gameTime // Uses timeMachine.currentTime internally
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### VisualKnotLogic
|
|
230
|
+
**File:** `VisualKnot/VisualKnotLogic.cs`
|
|
231
|
+
**Role:** Path waypoint management for 3D games
|
|
232
|
+
|
|
233
|
+
**Key Classes:**
|
|
234
|
+
```csharp
|
|
235
|
+
class VisualKnot : TimeKnot
|
|
236
|
+
{
|
|
237
|
+
float time // Knot time
|
|
238
|
+
float lane // Lane position
|
|
239
|
+
int noteIdx // Note index
|
|
240
|
+
string type // Knot type
|
|
241
|
+
|
|
242
|
+
float zPos // Z position
|
|
243
|
+
Vector3 warpedPosition // 3D position after warp
|
|
244
|
+
Quaternion warpedRotation // 3D rotation after warp
|
|
245
|
+
NoteBase note // Associated note
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
class VisualKnotLogic : ListTimeKnots<VisualKnot>
|
|
249
|
+
{
|
|
250
|
+
void CalculateWarpedPositions(RhythmContext)
|
|
251
|
+
Vector2 GetPositionAtTime(float time)
|
|
252
|
+
void ExtractKnotsByNoteIdx(List<VisualKnot>, int noteIdx)
|
|
253
|
+
(VisualKnot prev, VisualKnot next, float percent) InterpolateKnotForNote(float, int)
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Usage:**
|
|
258
|
+
```csharp
|
|
259
|
+
// In RhythmContext
|
|
260
|
+
context.visualKnotLogic.AddKnot(...)
|
|
261
|
+
context.visualKnotLogic.CalculateWarpedPositions(context)
|
|
262
|
+
var pos = context.visualKnotLogic.GetPositionAtTime(time)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
#### ListTimeKnots<T> (abstract generic)
|
|
266
|
+
**File:** `TimeKnot/ListTimeKnots.cs`
|
|
267
|
+
**Role:** Base class for time-sorted collections
|
|
268
|
+
**Used by:** `VisualKnotLogic`, `MetaLogic`
|
|
269
|
+
|
|
270
|
+
**Key Methods:**
|
|
271
|
+
```csharp
|
|
272
|
+
(T prev, T next, float percent) InterpolateKnot(float time)
|
|
273
|
+
T GetKnotAtIndex(int index)
|
|
274
|
+
void Sort()
|
|
275
|
+
void Clear()
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
#### RhythmStateMachine
|
|
279
|
+
**Files:** `StateMachine/RhythmStateMachine.cs` (+ State.cs)
|
|
280
|
+
**Role:** State machine implementation
|
|
281
|
+
|
|
282
|
+
**Key Methods:**
|
|
283
|
+
```csharp
|
|
284
|
+
void Add(string stateName, params string[] allowedNextStates)
|
|
285
|
+
void SetStateCallbacks(string stateName, Action onEnter, Action onExit)
|
|
286
|
+
bool Validate() // Validate transitions
|
|
287
|
+
void Start(string stateName) // Set initial state
|
|
288
|
+
bool CanTransitionTo(string nextState)
|
|
289
|
+
bool TransitionTo(string nextState)
|
|
290
|
+
bool Reset(string initialState)
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**Events:**
|
|
294
|
+
```csharp
|
|
295
|
+
Action<string, string> onStateChanged // (prevState, newState)
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Usage:**
|
|
299
|
+
```csharp
|
|
300
|
+
// Setup (in RhythmContext.SetupStateMachine)
|
|
301
|
+
stateMachine.Add(GAME_NONE, GAME_INITED);
|
|
302
|
+
stateMachine.Add(GAME_INITED, GAME_SONG_LOADED);
|
|
303
|
+
stateMachine.Add(GAME_SONG_LOADED, GAME_PREPARE);
|
|
304
|
+
// ... etc
|
|
305
|
+
|
|
306
|
+
// Transition
|
|
307
|
+
context.GameState = GAME_START; // Uses stateMachine internally
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
#### MetaLogic
|
|
311
|
+
**File:** `Meta/MetaLogic.cs`
|
|
312
|
+
**Role:** Dynamic song-synchronized parameters
|
|
313
|
+
|
|
314
|
+
**Key Classes:**
|
|
315
|
+
```csharp
|
|
316
|
+
class MetaInfo : TimeKnot
|
|
317
|
+
{
|
|
318
|
+
float duration
|
|
319
|
+
string value
|
|
320
|
+
float endTime
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
class MetaLogic : ListTimeKnots<MetaInfo>
|
|
324
|
+
{
|
|
325
|
+
string id
|
|
326
|
+
MetaInfo currentMeta
|
|
327
|
+
MetaInfo nextMeta
|
|
328
|
+
|
|
329
|
+
void AddMetaInfo(float time, string value)
|
|
330
|
+
void Calculate(float? endTime)
|
|
331
|
+
bool Update(float time) // Returns true if changed
|
|
332
|
+
string GetValueAtTime(float time)
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**Subclass Example:**
|
|
337
|
+
```csharp
|
|
338
|
+
class VisualSpeedMeta : MetaLogic
|
|
339
|
+
{
|
|
340
|
+
class Info : MetaInfo
|
|
341
|
+
{
|
|
342
|
+
float speed // Visual speed value
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Usage:**
|
|
348
|
+
```csharp
|
|
349
|
+
// In RhythmContext
|
|
350
|
+
context.gameMetas["mood"] = new MoodMeta("mood");
|
|
351
|
+
context.gameMetas["speed"] = new VisualSpeedMeta("speed");
|
|
352
|
+
|
|
353
|
+
// Update each frame
|
|
354
|
+
foreach (var meta in context.gameMetas.Values)
|
|
355
|
+
{
|
|
356
|
+
if (meta.Update(context.gameTime))
|
|
357
|
+
{
|
|
358
|
+
// Meta changed, react to it
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
#### VisualSpeedMeta
|
|
364
|
+
**File:** `Meta/VisualSpeedMeta.cs`
|
|
365
|
+
**Role:** Control visual speed over time
|
|
366
|
+
**Extends:** `MetaLogic`
|
|
367
|
+
|
|
368
|
+
**Usage:**
|
|
369
|
+
```csharp
|
|
370
|
+
// In RhythmContext
|
|
371
|
+
float visualSpeed => visualSpeedMeta.currentMeta?.speed ?? config.visualSpeed
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
### 4. Input System (Runtime/Input/)
|
|
377
|
+
|
|
378
|
+
**Files:** `Input/Base/` and `Input/Components/`
|
|
379
|
+
|
|
380
|
+
#### IInputHandler (interface)
|
|
381
|
+
**Role:** Input handler interface
|
|
382
|
+
|
|
383
|
+
#### BaseTileInput (abstract)
|
|
384
|
+
**Role:** Base tile input component
|
|
385
|
+
**Extends:** `MonoBehaviour, IInputHandler`
|
|
386
|
+
|
|
387
|
+
#### Concrete Input Components
|
|
388
|
+
All extend `BaseTileInput`:
|
|
389
|
+
- **TouchInput** - Instant tap/touch
|
|
390
|
+
- **HoldInput** - Continuous press/hold
|
|
391
|
+
- **SwipeInput** - Directional swipe gestures
|
|
392
|
+
- **DragInput** - Continuous drag
|
|
393
|
+
|
|
394
|
+
**Enums:**
|
|
395
|
+
```csharp
|
|
396
|
+
enum InputPhase { Start, Progress, End }
|
|
397
|
+
enum InputDirection { None, Up, Down, Left, Right }
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
### 5. VisualWarp System (Runtime/Rhythm/System/VisualWarp/)
|
|
403
|
+
|
|
404
|
+
#### IVisualWarp (interface)
|
|
405
|
+
**File:** `IVisualWarp.cs`
|
|
406
|
+
**Role:** 3D perspective transformation for curved games
|
|
407
|
+
**Method:**
|
|
408
|
+
```csharp
|
|
409
|
+
(Vector3 position, Quaternion rotation) GetWarped(float time, float lane)
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
#### LinearVisualWarp
|
|
413
|
+
**File:** `LinearVisualWarp.cs`
|
|
414
|
+
**Role:** Default linear warp (no transformation)
|
|
415
|
+
**Implements:** `IVisualWarp`
|
|
416
|
+
|
|
417
|
+
**Custom implementations:**
|
|
418
|
+
- `DRCurvedVisualWarp` (Dancing Road) - Creates curved 3D path illusion
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
### 6. MoodChange System (Runtime/MoodChange/)
|
|
423
|
+
|
|
424
|
+
#### MoodChange
|
|
425
|
+
**File:** `MoodChange.cs`
|
|
426
|
+
**Role:** Color/theme management
|
|
427
|
+
**Responds to:** Meta events with key="mood"
|
|
428
|
+
|
|
429
|
+
#### AdjustHue
|
|
430
|
+
**Files:** `AdjustHue.cs` (+ 5 component info files)
|
|
431
|
+
**Role:** Component-based hue adjustment
|
|
432
|
+
**Targets:** SpriteRenderer, Material, ParticleSystem, TrailRenderer
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
### 7. Helper Components (Runtime/Rhythm/Components/Helper/)
|
|
437
|
+
|
|
438
|
+
- **CameraFollow** - Camera following behavior
|
|
439
|
+
- **MeshSpriteSorter** - Mesh/sprite rendering order
|
|
440
|
+
- **RecycleLayoutZ** - Z-axis recycling layout
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
### 8. Math Utilities (Runtime/Rhythm/Math/)
|
|
445
|
+
|
|
446
|
+
#### Parabol
|
|
447
|
+
**File:** `Parabol.cs`
|
|
448
|
+
**Role:** Parabolic arc calculation
|
|
449
|
+
**Usage:** Jump physics in HB3, TH3
|
|
450
|
+
|
|
451
|
+
```csharp
|
|
452
|
+
public static float Calculate(float h, float t)
|
|
453
|
+
{
|
|
454
|
+
return 4f * h * t * (1f - t);
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
460
|
+
### 9. Preset Components (Runtime/Preset/)
|
|
461
|
+
|
|
462
|
+
Pre-built components for common features:
|
|
463
|
+
- **ScoreText** - Score display
|
|
464
|
+
- **WowText** - Feedback text ("Perfect!", "Great!")
|
|
465
|
+
- **StartHint** - Start game hint
|
|
466
|
+
- **AudioSourcePlayer** - Audio player component
|
|
467
|
+
- **ParticleSystemPlayer** - Particle player component
|
|
468
|
+
- **AudioTimeText** - Audio time display
|
|
469
|
+
- **RendererAlpha** - Renderer alpha control
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## Constants & Events
|
|
474
|
+
|
|
475
|
+
### GameEvent (static class)
|
|
476
|
+
**File:** `System/Event/GameEvent.cs`
|
|
477
|
+
**Role:** State machine event constants
|
|
478
|
+
|
|
479
|
+
```csharp
|
|
480
|
+
public static class GameEvent
|
|
481
|
+
{
|
|
482
|
+
// State constants
|
|
483
|
+
public const string GAME_NONE = "GAME_NONE";
|
|
484
|
+
public const string GAME_INITED = "GAME_INITED";
|
|
485
|
+
public const string GAME_SONG_LOADED = "GAME_SONG_LOADED";
|
|
486
|
+
public const string GAME_PREPARE = "GAME_PREPARE";
|
|
487
|
+
public const string GAME_READY = "GAME_READY";
|
|
488
|
+
public const string GAME_START = "GAME_START";
|
|
489
|
+
public const string GAME_PLAY = "GAME_PLAY";
|
|
490
|
+
public const string GAME_PAUSE = "GAME_PAUSE";
|
|
491
|
+
public const string GAME_DIE = "GAME_DIE";
|
|
492
|
+
public const string GAME_REWIND = "GAME_REWIND";
|
|
493
|
+
public const string GAME_REVIVE = "GAME_REVIVE";
|
|
494
|
+
public const string GAME_END = "GAME_END";
|
|
495
|
+
public const string GAME_END_ROUND = "GAME_END_ROUND";
|
|
496
|
+
public const string GAME_STOP = "GAME_STOP";
|
|
497
|
+
public const string GAME_SHUTDOWN = "GAME_SHUTDOWN";
|
|
498
|
+
|
|
499
|
+
// State categories
|
|
500
|
+
public static class Category
|
|
501
|
+
{
|
|
502
|
+
public static readonly HashSet<string> Active = new()
|
|
503
|
+
{
|
|
504
|
+
GAME_PLAY, GAME_START, GAME_READY, GAME_REVIVE
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
## State Machine Flow (Source-Verified)
|
|
513
|
+
|
|
514
|
+
**Implementation:** `RhythmStateMachine` class in `System/StateMachine/`
|
|
515
|
+
**Setup:** `RhythmGame.SetupStateMachine()` method
|
|
516
|
+
**Constants:** `GameEvent` static class
|
|
517
|
+
|
|
518
|
+
### Complete State Diagram
|
|
519
|
+
|
|
520
|
+
```mermaid
|
|
521
|
+
stateDiagram-v2
|
|
522
|
+
[*] --> GAME_NONE
|
|
523
|
+
|
|
524
|
+
GAME_NONE --> GAME_INITED : Init()
|
|
525
|
+
GAME_INITED --> GAME_SONG_LOADED : LoadSong()
|
|
526
|
+
GAME_INITED --> GAME_SHUTDOWN : [error]
|
|
527
|
+
|
|
528
|
+
GAME_SONG_LOADED --> GAME_PREPARE : Prepare()
|
|
529
|
+
GAME_SONG_LOADED --> GAME_SHUTDOWN : [error]
|
|
530
|
+
|
|
531
|
+
GAME_PREPARE --> GAME_READY : Ready()
|
|
532
|
+
GAME_PREPARE --> GAME_NOT_READY : [error]
|
|
533
|
+
GAME_PREPARE --> GAME_SHUTDOWN : [error]
|
|
534
|
+
|
|
535
|
+
GAME_NOT_READY --> GAME_PREPARE : [retry]
|
|
536
|
+
GAME_NOT_READY --> GAME_SHUTDOWN : [abort]
|
|
537
|
+
|
|
538
|
+
GAME_READY --> GAME_START : StartGame()
|
|
539
|
+
GAME_READY --> GAME_PREPARE : StopGame()
|
|
540
|
+
GAME_READY --> GAME_SHUTDOWN : [abort]
|
|
541
|
+
|
|
542
|
+
GAME_START --> GAME_PLAY : [alias]
|
|
543
|
+
GAME_START --> GAME_PAUSE : PauseGame()
|
|
544
|
+
GAME_START --> GAME_DIE : DieGame()
|
|
545
|
+
GAME_START --> GAME_END : [complete]
|
|
546
|
+
GAME_START --> GAME_END_ROUND : [round complete]
|
|
547
|
+
GAME_START --> GAME_PREPARE : StopGame()
|
|
548
|
+
GAME_START --> GAME_SHUTDOWN : [error]
|
|
549
|
+
|
|
550
|
+
GAME_PLAY --> GAME_PAUSE : PauseGame()
|
|
551
|
+
GAME_PLAY --> GAME_DIE : DieGame()
|
|
552
|
+
GAME_PLAY --> GAME_END : [complete]
|
|
553
|
+
GAME_PLAY --> GAME_END_ROUND : [round complete]
|
|
554
|
+
GAME_PLAY --> GAME_PREPARE : StopGame()
|
|
555
|
+
GAME_PLAY --> GAME_SHUTDOWN : [error]
|
|
556
|
+
|
|
557
|
+
GAME_PAUSE --> GAME_PLAY : ResumeGame()
|
|
558
|
+
GAME_PAUSE --> GAME_PREPARE : StopGame()
|
|
559
|
+
GAME_PAUSE --> GAME_SHUTDOWN : [error]
|
|
560
|
+
|
|
561
|
+
GAME_DIE --> GAME_REWIND : [auto-rewind]
|
|
562
|
+
GAME_DIE --> GAME_PREPARE : [no rewind]
|
|
563
|
+
GAME_DIE --> GAME_SHUTDOWN : [error]
|
|
564
|
+
|
|
565
|
+
GAME_REWIND --> GAME_REVIVE : [complete]
|
|
566
|
+
GAME_REWIND --> GAME_SHUTDOWN : [error]
|
|
567
|
+
|
|
568
|
+
GAME_REVIVE --> GAME_PLAY : ReviveGame()
|
|
569
|
+
|
|
570
|
+
GAME_END --> GAME_PREPARE : [restart]
|
|
571
|
+
GAME_END --> GAME_SHUTDOWN : [exit]
|
|
572
|
+
|
|
573
|
+
GAME_END_ROUND --> GAME_PREPARE : [endless loop]
|
|
574
|
+
GAME_END_ROUND --> GAME_SHUTDOWN : [exit]
|
|
575
|
+
|
|
576
|
+
GAME_SHUTDOWN --> GAME_NONE
|
|
577
|
+
GAME_SHUTDOWN --> [*]
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### State Categories
|
|
581
|
+
|
|
582
|
+
**From GameEvent.Category:**
|
|
583
|
+
```csharp
|
|
584
|
+
PreGame: GAME_NONE, GAME_INITED, GAME_SONG_LOADED, GAME_PREPARE
|
|
585
|
+
Gameplay: GAME_READY, GAME_START, GAME_PLAY, GAME_PAUSE, GAME_DIE,
|
|
586
|
+
GAME_REWIND, GAME_REVIVE, GAME_END, GAME_END_ROUND
|
|
587
|
+
Active: All Gameplay + GAME_PREPARE
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### State Machine Setup
|
|
591
|
+
|
|
592
|
+
**In RhythmGame.SetupStateMachine():**
|
|
593
|
+
```csharp
|
|
594
|
+
var sm = context.stateMachine;
|
|
595
|
+
|
|
596
|
+
// Initialization chain
|
|
597
|
+
sm.Add(GAME_NONE, GAME_INITED);
|
|
598
|
+
sm.Add(GAME_INITED, GAME_SONG_LOADED, GAME_SHUTDOWN);
|
|
599
|
+
sm.Add(GAME_SONG_LOADED, GAME_PREPARE, GAME_SHUTDOWN);
|
|
600
|
+
sm.Add(GAME_PREPARE, GAME_READY, GAME_NOT_READY, GAME_SHUTDOWN);
|
|
601
|
+
sm.Add(GAME_READY, GAME_START, GAME_PREPARE, GAME_SHUTDOWN);
|
|
602
|
+
|
|
603
|
+
// Active gameplay
|
|
604
|
+
sm.Add(GAME_START, GAME_PLAY, GAME_PAUSE, GAME_DIE, GAME_END,
|
|
605
|
+
GAME_END_ROUND, GAME_PREPARE, GAME_SHUTDOWN);
|
|
606
|
+
sm.Add(GAME_PLAY, GAME_PAUSE, GAME_DIE, GAME_END, GAME_END_ROUND,
|
|
607
|
+
GAME_PREPARE, GAME_SHUTDOWN);
|
|
608
|
+
sm.Add(GAME_PAUSE, GAME_PLAY, GAME_PREPARE, GAME_SHUTDOWN);
|
|
609
|
+
|
|
610
|
+
// Death & rewind (if enabled)
|
|
611
|
+
sm.Add(GAME_DIE, GAME_REWIND, GAME_PREPARE, GAME_SHUTDOWN);
|
|
612
|
+
sm.Add(GAME_REWIND, GAME_REVIVE, GAME_SHUTDOWN);
|
|
613
|
+
sm.Add(GAME_REVIVE, GAME_PLAY, GAME_SHUTDOWN);
|
|
614
|
+
|
|
615
|
+
// Ending
|
|
616
|
+
sm.Add(GAME_END, GAME_PREPARE, GAME_SHUTDOWN);
|
|
617
|
+
sm.Add(GAME_END_ROUND, GAME_PREPARE, GAME_SHUTDOWN);
|
|
618
|
+
sm.Add(GAME_SHUTDOWN, GAME_NONE);
|
|
619
|
+
|
|
620
|
+
// Validate
|
|
621
|
+
sm.Validate();
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
## Usage Patterns
|
|
627
|
+
|
|
628
|
+
### Creating a Game
|
|
629
|
+
```csharp
|
|
630
|
+
using Amanotes.MagicTilesCore;
|
|
631
|
+
using static Amanotes.MagicTilesCore.GameEvent;
|
|
632
|
+
|
|
633
|
+
public class MyGame : RhythmGame
|
|
634
|
+
{
|
|
635
|
+
protected override void Awake()
|
|
636
|
+
{
|
|
637
|
+
base.Awake();
|
|
638
|
+
context.OnGameStateChange += OnStateChange;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
public override RhythmMatch CreateMatchData()
|
|
642
|
+
{
|
|
643
|
+
return new MyMatchData().Init(context);
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
protected void OnStateChange(string state)
|
|
647
|
+
{
|
|
648
|
+
if (state == GAME_START)
|
|
649
|
+
{
|
|
650
|
+
// Game started
|
|
651
|
+
}
|
|
652
|
+
else if (state == GAME_END)
|
|
653
|
+
{
|
|
654
|
+
// Game ended
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
### Creating a Tile
|
|
661
|
+
```csharp
|
|
662
|
+
public class MyTile : RhythmTile
|
|
663
|
+
{
|
|
664
|
+
public override void OnAttach()
|
|
665
|
+
{
|
|
666
|
+
// Setup when spawned
|
|
667
|
+
transform.position = GetPositionForNote(tileContext.note);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
public override void OnDetach()
|
|
671
|
+
{
|
|
672
|
+
// Cleanup when despawned
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
public override void RefreshTileStatus()
|
|
676
|
+
{
|
|
677
|
+
base.RefreshTileStatus();
|
|
678
|
+
|
|
679
|
+
// Update visuals based on tileContext.Status
|
|
680
|
+
switch (tileContext.Status)
|
|
681
|
+
{
|
|
682
|
+
case TileStatus.None: // Waiting for touch
|
|
683
|
+
break;
|
|
684
|
+
case TileStatus.Touching: // Being touched
|
|
685
|
+
break;
|
|
686
|
+
case TileStatus.End: // Touch completed
|
|
687
|
+
break;
|
|
688
|
+
case TileStatus.Missed: // Missed
|
|
689
|
+
break;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
### Using MetaLogic
|
|
696
|
+
```csharp
|
|
697
|
+
public class MoodMeta : MetaLogic
|
|
698
|
+
{
|
|
699
|
+
public MoodMeta(string id) : base(id) { }
|
|
700
|
+
|
|
701
|
+
public override bool Update(float time)
|
|
702
|
+
{
|
|
703
|
+
var changed = base.Update(time);
|
|
704
|
+
if (changed)
|
|
705
|
+
{
|
|
706
|
+
// Apply mood change
|
|
707
|
+
var moodValue = currentMeta.value;
|
|
708
|
+
ApplyMood(moodValue);
|
|
709
|
+
}
|
|
710
|
+
return changed;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// In game setup
|
|
715
|
+
context.gameMetas["mood"] = new MoodMeta("mood");
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
---
|
|
719
|
+
|
|
720
|
+
## Class Count Summary
|
|
721
|
+
|
|
722
|
+
**Total C# Files:** 66
|
|
723
|
+
**Core Classes:** 9 (RhythmGame, RhythmTile, RhythmContext, RhythmConfig, RhythmMatch, etc.)
|
|
724
|
+
**System Classes:** 12 (MTCTimeMachine, VisualKnotLogic, MetaLogic, RhythmStateMachine, etc.)
|
|
725
|
+
**Input Classes:** 6 (IInputHandler, BaseTileInput, TouchInput, HoldInput, SwipeInput, DragInput)
|
|
726
|
+
**Helper Classes:** 12 (MoodChange, AdjustHue, CameraFollow, Parabol, etc.)
|
|
727
|
+
**Preset Components:** 7 (ScoreText, WowText, StartHint, etc.)
|
|
728
|
+
|
|
729
|
+
**Verified:** All class names, file paths, and relationships confirmed from source
|