Examples

The package includes four example scenes built on Duck Shooter, a small arcade space shooter. You fly a ship along the bottom of the screen and shoot rubber ducks. Each scene focuses on one part of the health system.

🎮 Try the Demo

Play the examples right here. Pick an example in the menu, and press Escape to return to it. Use the button in the bottom-right corner for full screen, or open the demo in a new tab.

🦆 The Scenes

The hub scene is in Glowing Rifts/Modular Health System/Examples and the Duck Shooter scenes in its DuckShooter folder. In the Duck Shooter scenes, press any key or click to start, move the mouse to steer, and hold the left mouse button or Space to fire.

🧭 Example Hub

Open the ModularHealthSystem_Examples scene to reach every example from one place. It has a button and a one-line description for each scene. Once you open an example from the hub, a Back (Esc) button stays on screen, and pressing Escape does the same: it frees the cursor and returns to the hub.

Tip

Start from ModularHealthSystem_Examples. An example scene opened on its own has no Back button and ignores Escape.

The ExampleSceneLoader script does the loading. Hook a button’s On Click to ExampleSceneLoader.Load with a scene name.

FieldDescription
Escape SceneScene loaded when Escape is pressed, ModularHealthSystem_Examples by default. Leave it empty to ignore Escape
Dont Destroy On LoadKeeps the object between scenes. A newer copy replaces the old one
Hide In Escape SceneAn object hidden while the Escape Scene is open, such as the Back button in the hub

The BackToHub prefab in Examples/Common/Prefabs is the hub’s Back button, set to persist between scenes and hide in the hub.

Note

In the Editor, ExampleSceneLoader can also load scenes that aren’t in Build Settings, so the hub works right after importing the package. In a build, add the scenes to Build Settings.

Note

The example scripts start with DS and are only there to drive the demo. The health parts are the package’s own components.

📁 Shared Example Scripts

ScriptRole
DSGameManagerStarts the game and respawns the player after death
DSPlayerControllerMoves the ship with the mouse and raises the shoot events
DSGunFires projectiles from a spawn point at random intervals while shooting
DSProjectileFlies forward and hurts the first Hitbox it hits
DSSoapThe ducks’ projectile, capped in count
DSWaveSpawns a prefab per formation point, then the next wave once all are dead
DSDuckFlies a duck to its formation slot and tints it
DSSpawner, DSHover, DSRotatorRandom spawn positions, a hovering motion and a constant spin

Tip

Open DSProjectile to see the smallest way to deal damage: find a Hitbox on what you hit and call Hurt.