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
- 01Generic decorator interface
- 02Percentage stat modifiers
- 03Flat stat modifiers
- 04Composable modifier stacking
Use cases
- 01Apply percentage changes to stats
- 02Add flat values to stats
- 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-patternAfter installing, type/unity-decorator-patternin Claude Code to confirm it loaded.
Bundled filesassets/code/Decorator.cs.txtreferences/guide.md
Details
From the project READMEUnity Decorator Pattern
Minimal decorator pattern for stat modification.
Core Features
- Generic Interface:
IDecorator<T>for any value type - Stat Modifiers: Percentage and flat modifications
- 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