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,391 @@
|
|
|
1
|
+
# Custom Game Implementation Guide
|
|
2
|
+
|
|
3
|
+
**Package:** `com.amanotes.magictilescore`
|
|
4
|
+
**Version:** 0.4.0
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# PART 1: Quick Start
|
|
9
|
+
|
|
10
|
+
Create a rhythm game with **3 classes**:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
YourGame/
|
|
14
|
+
├── YourGameConfig.cs # Game settings
|
|
15
|
+
├── YourGame.cs # Game controller
|
|
16
|
+
└── YourTile.cs # Tile visual + input
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Step 1: Game Config
|
|
22
|
+
|
|
23
|
+
`YourGameConfig.cs`
|
|
24
|
+
|
|
25
|
+
```csharp
|
|
26
|
+
using Amanotes.MagicTilesCore;
|
|
27
|
+
using UnityEngine;
|
|
28
|
+
|
|
29
|
+
[CreateAssetMenu(menuName = "YourGame/Config")]
|
|
30
|
+
public class YourGameConfig : RhythmConfig
|
|
31
|
+
{
|
|
32
|
+
// Add custom settings here if needed
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`RhythmConfig` provides everything you need.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Step 2: Game Controller
|
|
41
|
+
|
|
42
|
+
`YourGame.cs`
|
|
43
|
+
|
|
44
|
+
```csharp
|
|
45
|
+
using Amanotes.MagicTilesCore;
|
|
46
|
+
|
|
47
|
+
public class YourGame : RhythmGame
|
|
48
|
+
{
|
|
49
|
+
// Framework handles everything
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Step 3: Tile Visual + Input
|
|
56
|
+
|
|
57
|
+
`YourTile.cs`
|
|
58
|
+
|
|
59
|
+
```csharp
|
|
60
|
+
using Amanotes.MagicTilesCore;
|
|
61
|
+
using UnityEngine;
|
|
62
|
+
|
|
63
|
+
public class YourTile : RhythmTile
|
|
64
|
+
{
|
|
65
|
+
[SerializeField] private TouchInput touchInput;
|
|
66
|
+
[SerializeField] private SpriteRenderer sprite;
|
|
67
|
+
|
|
68
|
+
public override void OnAttach()
|
|
69
|
+
{
|
|
70
|
+
// Position tile (framework handles 2D/3D automatically)
|
|
71
|
+
var (pos, rot) = context.GetWarped(
|
|
72
|
+
tileContext.note.time,
|
|
73
|
+
tileContext.note.lane
|
|
74
|
+
);
|
|
75
|
+
transform.localPosition = pos;
|
|
76
|
+
transform.localRotation = rot;
|
|
77
|
+
|
|
78
|
+
// Setup input
|
|
79
|
+
touchInput.onTouchDown += OnTouched;
|
|
80
|
+
sprite.color = Color.white;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public override void OnDetach()
|
|
84
|
+
{
|
|
85
|
+
touchInput.onTouchDown -= OnTouched;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private void OnTouched()
|
|
89
|
+
{
|
|
90
|
+
if (tileContext.Status != TileStatus.None) return;
|
|
91
|
+
|
|
92
|
+
tileContext.Status = TileStatus.Touching;
|
|
93
|
+
sprite.color = Color.green;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Key Concept:** `context.GetWarped()` positions tiles for both 2D and 3D games!
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### Step 4: Unity Setup
|
|
103
|
+
|
|
104
|
+
#### 4.1: Create Assets
|
|
105
|
+
|
|
106
|
+
**Create Config:**
|
|
107
|
+
- Right-click → Create → YourGame/Config
|
|
108
|
+
- Set: Visual Speed: `5.0`, N Lanes: `4`
|
|
109
|
+
- Tile Pool Group → Add Entry:
|
|
110
|
+
- ID: `"Tile"`
|
|
111
|
+
- Prefab: (your tile prefab)
|
|
112
|
+
- Pool Size: `20`
|
|
113
|
+
|
|
114
|
+
**Create Context:**
|
|
115
|
+
- Right-click → Create → Rhythm/Context
|
|
116
|
+
- Assign: Config (your config asset), Song Notes (your song data)
|
|
117
|
+
|
|
118
|
+
#### 4.2: Scene Setup
|
|
119
|
+
|
|
120
|
+
**Hierarchy:**
|
|
121
|
+
```
|
|
122
|
+
YourGameScene
|
|
123
|
+
├── YourGame (GameObject)
|
|
124
|
+
├── MainCamera
|
|
125
|
+
└── Canvas
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**YourGame GameObject:**
|
|
129
|
+
- Add `YourGame.cs` component
|
|
130
|
+
- Add `PrefabPool` component
|
|
131
|
+
- Create child: Empty Transform named "TileParent"
|
|
132
|
+
- Assign: Context, Pool, Tile Parent
|
|
133
|
+
|
|
134
|
+
#### 4.3: Create Tile Prefab
|
|
135
|
+
|
|
136
|
+
- Create GameObject with: `YourTile.cs`, `TouchInput`, `SpriteRenderer`
|
|
137
|
+
- Save as prefab
|
|
138
|
+
- Assign to Config's Tile Pool Group
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## ✅ Done!
|
|
143
|
+
|
|
144
|
+
Press Play! Working rhythm game.
|
|
145
|
+
|
|
146
|
+
**What happens:**
|
|
147
|
+
- Tiles spawn automatically
|
|
148
|
+
- Player touches → tile turns green
|
|
149
|
+
- Framework handles timing, pooling, lifecycle
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
# PART 2: Understanding & Customizing
|
|
154
|
+
|
|
155
|
+
## What You Inherited
|
|
156
|
+
|
|
157
|
+
**RhythmConfig Provides:**
|
|
158
|
+
|
|
159
|
+
```csharp
|
|
160
|
+
// Timing
|
|
161
|
+
float visualSpeed; // Tile movement speed
|
|
162
|
+
float mp3Offset; // Audio sync
|
|
163
|
+
float gameDepartTime; // Start delay
|
|
164
|
+
|
|
165
|
+
// Layout
|
|
166
|
+
int nLanes; // Number of lanes
|
|
167
|
+
float laneW; // Lane width
|
|
168
|
+
float zUnitDistance; // Distance per second
|
|
169
|
+
|
|
170
|
+
// Pooling
|
|
171
|
+
PoolGroup tilePoolGroup; // Tile pool settings
|
|
172
|
+
PoolGroup vfxPoolGroup; // VFX pool settings
|
|
173
|
+
|
|
174
|
+
// Behavior
|
|
175
|
+
bool isAutoRewind; // Auto-rewind on death
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**RhythmGame Provides:**
|
|
179
|
+
|
|
180
|
+
```csharp
|
|
181
|
+
// Components
|
|
182
|
+
public RhythmContext context;
|
|
183
|
+
public PrefabPool pool;
|
|
184
|
+
public Transform tileParent;
|
|
185
|
+
|
|
186
|
+
// Override if needed
|
|
187
|
+
virtual RhythmMatch CreateMatchData();
|
|
188
|
+
virtual RhythmTile CreateRhythmTile(SongNote note);
|
|
189
|
+
virtual void HandleMissedTile(TileContext tile);
|
|
190
|
+
virtual float GetMissedThreshold();
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**RhythmTile Provides:**
|
|
194
|
+
|
|
195
|
+
```csharp
|
|
196
|
+
// Properties (set when OnAttach called)
|
|
197
|
+
public RhythmContext context;
|
|
198
|
+
public TileContext tileContext;
|
|
199
|
+
|
|
200
|
+
// Override methods
|
|
201
|
+
public abstract void OnAttach(); // Tile spawns
|
|
202
|
+
public virtual void OnDetach(); // Tile despawns
|
|
203
|
+
public virtual void RefreshTileStatus(); // Status changes
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**TileContext Has:**
|
|
207
|
+
|
|
208
|
+
```csharp
|
|
209
|
+
readonly SongNote note; // time, lane, type
|
|
210
|
+
readonly List<VisualKnot> knots; // Cached warped positions/rotations
|
|
211
|
+
// Roughly matches note.time + note.controls[i].time
|
|
212
|
+
TileStatus Status; // None, Touching, End, Missed
|
|
213
|
+
float accuracy; // 0-1 hit accuracy
|
|
214
|
+
float FillingProgress; // 0-1 for long tiles
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Custom Tile Feedback
|
|
220
|
+
|
|
221
|
+
```csharp
|
|
222
|
+
// YourTile.cs
|
|
223
|
+
public override void RefreshTileStatus()
|
|
224
|
+
{
|
|
225
|
+
switch (tileContext.Status)
|
|
226
|
+
{
|
|
227
|
+
case TileStatus.None:
|
|
228
|
+
sprite.color = Color.white;
|
|
229
|
+
break;
|
|
230
|
+
case TileStatus.Touching:
|
|
231
|
+
sprite.color = Color.green;
|
|
232
|
+
break;
|
|
233
|
+
case TileStatus.End:
|
|
234
|
+
sprite.color = Color.blue;
|
|
235
|
+
break;
|
|
236
|
+
case TileStatus.Missed:
|
|
237
|
+
sprite.color = Color.red;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Custom Scoring Logic
|
|
246
|
+
|
|
247
|
+
```csharp
|
|
248
|
+
using Amanotes.MagicTilesCore;
|
|
249
|
+
|
|
250
|
+
public class YourMatchData : RhythmMatch
|
|
251
|
+
{
|
|
252
|
+
public int combo;
|
|
253
|
+
public int perfectCount;
|
|
254
|
+
|
|
255
|
+
public override RhythmMatch Init(RhythmContext context)
|
|
256
|
+
{
|
|
257
|
+
base.Init(context);
|
|
258
|
+
combo = 0;
|
|
259
|
+
perfectCount = 0;
|
|
260
|
+
return this;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
public override void CalculateScore(TileContext tile)
|
|
264
|
+
{
|
|
265
|
+
if (tile.accuracy >= 0.9f) // Perfect!
|
|
266
|
+
{
|
|
267
|
+
perfectCount++;
|
|
268
|
+
combo++;
|
|
269
|
+
AddScore(100 * combo);
|
|
270
|
+
}
|
|
271
|
+
else
|
|
272
|
+
{
|
|
273
|
+
combo = 0;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Use in game:**
|
|
280
|
+
|
|
281
|
+
```csharp
|
|
282
|
+
public override RhythmMatch CreateMatchData()
|
|
283
|
+
{
|
|
284
|
+
return new YourMatchData().Init(context);
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Implement Long Tiles (Hold/Slide)
|
|
291
|
+
|
|
292
|
+
```csharp
|
|
293
|
+
public class YourLongTile : RhythmTile, ITileProgress
|
|
294
|
+
{
|
|
295
|
+
[SerializeField] private HoldInput holdInput;
|
|
296
|
+
[SerializeField] private Transform progressBar;
|
|
297
|
+
|
|
298
|
+
public override void OnAttach()
|
|
299
|
+
{
|
|
300
|
+
var (pos, rot) = context.GetWarped(
|
|
301
|
+
tileContext.note.time,
|
|
302
|
+
tileContext.note.lane
|
|
303
|
+
);
|
|
304
|
+
transform.localPosition = pos;
|
|
305
|
+
transform.localRotation = rot;
|
|
306
|
+
|
|
307
|
+
holdInput.onHoldStart += () =>
|
|
308
|
+
{
|
|
309
|
+
tileContext.Status = TileStatus.Touching;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
holdInput.onHoldEnd += () =>
|
|
313
|
+
{
|
|
314
|
+
tileContext.Status = TileStatus.End;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
public void RefreshTileProgress()
|
|
319
|
+
{
|
|
320
|
+
// Called automatically during hold
|
|
321
|
+
float progress = tileContext.FillingProgress;
|
|
322
|
+
progressBar.localScale = new Vector3(1f, progress, 1f);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Game Flow
|
|
330
|
+
|
|
331
|
+
**How It Works:**
|
|
332
|
+
|
|
333
|
+
```
|
|
334
|
+
1. Framework spawns tile → OnAttach() called
|
|
335
|
+
2. Player touches → Status = Touching
|
|
336
|
+
3. Framework detects status change → RefreshTileStatus() called
|
|
337
|
+
4. Tile despawns → OnDetach() called
|
|
338
|
+
5. Tile returned to pool
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Lifecycle:**
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
Awake() → Init() → Prepare() → StartGame() → [Playing] → EndGame()
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Game States:**
|
|
348
|
+
|
|
349
|
+
```csharp
|
|
350
|
+
GAME_NONE // Not initialized
|
|
351
|
+
GAME_INITED // Ready
|
|
352
|
+
GAME_PREPARE // Loading
|
|
353
|
+
GAME_PLAY // Playing
|
|
354
|
+
GAME_PAUSE // Paused
|
|
355
|
+
GAME_DIE // Failed
|
|
356
|
+
GAME_END // Finished
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**Add callbacks:**
|
|
360
|
+
|
|
361
|
+
```csharp
|
|
362
|
+
protected override void SetupStateCallbacks()
|
|
363
|
+
{
|
|
364
|
+
base.SetupStateCallbacks();
|
|
365
|
+
|
|
366
|
+
context.stateMachine.SetStateCallbacks(GAME_START,
|
|
367
|
+
onEnter: () => Debug.Log("Started!"),
|
|
368
|
+
onExit: null
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Critical APIs
|
|
376
|
+
|
|
377
|
+
**Tile Positioning:**
|
|
378
|
+
|
|
379
|
+
```csharp
|
|
380
|
+
// ALWAYS use this!
|
|
381
|
+
var (pos, rot) = context.GetWarped(time, lane);
|
|
382
|
+
transform.localPosition = pos;
|
|
383
|
+
transform.localRotation = rot;
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Handles both 2D linear and 3D curved paths automatically.
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
**Last Updated:** 2026-01-23
|
|
391
|
+
**Source:** MagicTilesCore v0.4.0
|