Match puzzle · Unity 6
A Royal Match–style match puzzle built in Unity 6 (6000.3) and C#, with ten JSON-driven levels, a move limit, and obstacle goals.
Overview
The player taps connected groups of same-colored cubes and clears them within a move limit. Clearing every obstacle on the level wins. Running out of moves opens a fail popup with retry.
Progress is saved between sessions, and the main menu resumes the current level.
Specials
Group size decides what the match becomes. Adjacent specials combine into larger explosions that can chain.
-
Group of 4–5
Becomes a rocket that sweeps a row or a column.
-
Group of 6+
Becomes TNT that clears a square.
-
Adjacent specials
Combine into a larger explosion that can chain.
Obstacles
-
Stone
Breaks only when hit by a special.
-
Vase
Falls with the board and has two hit points.
-
Chalice box
A 2×2 box that opens, then the chalices inside are collected.
Architecture
Simulation stays separate from presentation. GridModel, Cell, and a polymorphic GridItem hierarchy (CubeItem, RocketItem, TntItem, and the obstacle types) hold the board as plain C# objects.
GroupFinder flood-fills matches with a queue and a hash set. FallController resolves gravity and spawns. LevelGoalTracker checks the win conditions.
GameplayController runs each turn as a coroutine so blasts, combos, falls, and the end state play in order. GridView and ItemVisual only render sprites and motion.
Levels are TextAsset JSON files parsed with JsonUtility into a typed grid. Art and level references live on a ScriptableObject loaded from Resources. The level scene, canvas, and HUD are built at runtime by a bootstrap instead of hand-placed prefabs.
Unity
Orthographic 2D rendering uses SpriteRenderer. The HUD, fail popup, and celebration are uGUI (Canvas, CanvasScaler, Image, Text). Board taps and UI use the new Input System. SceneManager handles the menu and level flow. PlayerPrefs stores the last unlocked level. Editor scripting (MenuItem, AssetDatabase, and a small EditorWindow) assembles scenes and assets.
C#
The rules stay in the model and the view stays thin: abstract classes and virtual methods, switch expressions and pattern matching, generic obstacle counts, IEquatable structs for grid positions, value types for damage, and expression-bodied members.
Technologies
Features
- Ten JSON-driven levels with a move limit
- Tap groups of matching cubes to clear them
- Rockets from groups of four or five, TNT from six or more
- Combined specials that chain into larger blasts
- Stones, two-hit vases, and 2×2 chalice boxes
- Win by clearing every obstacle; fail popup and retry when moves run out
- Saved progress and a main menu that resumes the current level
- Plain C# board model, with views that only render
- Runtime bootstrap for the level scene, canvas, and HUD