mcpField
U
unity-decorator-pattern

unity-decorator-pattern

github.com/muharremtozanDevelopment1751 installsUpdated 22w ago
Repository

About unity-decorator-pattern

unity-decorator-pattern is a minimal Unity skill with a decorator pattern for modifying stats. It provides generic decorators for percentage and flat changes that can be stacked to calculate a final value.

Key features

  1. 01Generic decorator interface
  2. 02Percentage stat modifiers
  3. 03Flat stat modifiers
  4. 04Composable modifier stacking

Use cases

  1. 01Apply percentage changes to stats
  2. 02Add flat values to stats
  3. 03Combine multiple stat modifiers

Install

Copy the command and run it in a terminal.

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

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

Bundled filesassets/code/Decorator.cs.txtreferences/guide.md

Details

From the project README

Unity Decorator Pattern

Minimal decorator pattern for stat modification.

Core Features

  1. Generic Interface: IDecorator<T> for any value type
  2. Stat Modifiers: Percentage and flat modifications
  3. Composable: Stack multiple decorators

Core Files (1 file)

  • Decorator.cs.txt: Complete decorator pattern (interface + base + modifiers)

Usage

IDecorator<float> damage = new BaseStat(100);
damage = new PercentageModifier(damage, 0.2f); // +20%
damage = new FlatModifier(damage, 10); // +10
float final = damage.GetValue(); // 130

Comments

Markdown supported