Magazine Component
The Magazine is the base script responsible for managing the weapon’s ammunition logic. It defines the core functionality used by all magazine types and is referenced by the Weapon to determine if it can shoot.
Tip
A weapon with no magazine assigned has infinite ammo. Assign one magazine to several weapons to share ammo between them.
Note
This base script is meant to be extended by more specific implementations such as bullet-based or rechargeable magazines.
✅ Responsibilities
- Holding ammo data (clip size and current count)
- Providing an interface for the weapon to read from
- Emitting an
On Depletedevent when the clip runs out, and stopping the weapon - Grouping its events (
On Depleted,On Start Reload,On Reload Complete) under Events in the inspector
🔋 Magazine Types
This system currently provides two magazine implementations:
- Bullet Magazine – traditional reloadable clip-based ammo
- Rechargeable Magazine – regenerates ammo automatically over time
Each one extends the base Magazine logic and introduces specialized behavior, which we’ll cover in the next documentation pages.