mcpField
U
unity-strategy-pattern

unity-strategy-pattern

github.com/muharremtozanDevelopment1754 installsUpdated 22w ago
Repository

About unity-strategy-pattern

A Unity skill for replacing conditional behavior with interchangeable Strategy objects. It supports ability and spell systems whose behaviors can be swapped at runtime and extended without changing PlayerController.

Key features

  1. 01Encapsulated behavior strategies
  2. 02Runtime strategy swapping
  3. 03Add behaviors without changing PlayerController
  4. 04ScriptableObject and class-based strategies
  5. 05Spell and ability system guidance

Use cases

  1. 01Replacing switch-based spell logic
  2. 02Changing an entity's behavior at runtime
  3. 03Adding abilities without modifying PlayerController

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/muharremtozan/unity-agent-skills --skill unity-strategy-pattern

After installing, type/unity-strategy-patternin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

assets/code/
OrbitalSpellStrategy.cs.txt
ShieldSpellStrategy.cs.txt
SpellStrategy.cs.txt
references/
guide.md

Details

From the project README

Unity Strategy Pattern

This skill implements the Strategy Behavioral Pattern to replace conditional logic (switches/ifs) with interchangeable algorithm objects.

Core Features

  1. Encapsulated Logic: Each behavior (Fireball, Shield, Orbital) lives in its own ScriptableObject or class.
  2. Hot-Swapping: Change an entity's behavior at runtime by swapping the strategy asset.
  3. 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.

Comments

Markdown supported