unity-strategy-pattern
Installation
SKILL.md
Unity Strategy Pattern
This skill implements the Strategy Behavioral Pattern to replace conditional logic (switches/ifs) with interchangeable algorithm objects.
Core Features
- Encapsulated Logic: Each behavior (Fireball, Shield, Orbital) lives in its own
ScriptableObjector class. - Hot-Swapping: Change an entity's behavior at runtime by swapping the strategy asset.
- Open/Closed Compliance: Add new spells/behaviors without modifying the
PlayerController.
Core Files (assets/code/)
SpellStrategy.cs.txt: Base abstract ScriptableObject (The Interface).ShieldSpellStrategy.cs.txt: Simple instantiation strategy.OrbitalSpellStrategy.cs.txt: Complex math/logic strategy (Pro Path).
Usage Guide
See GUIDE.md to learn how to create flexible Ability/Spell systems using Strategies.