MuharremTozan/Agentic-Duel / .agent/skills/unity-memento-pattern
unity-memento-pattern
VerifiedImplements the Memento pattern for capturing and restoring object states. Perfect for Loadout managers, Checkpoints, and Undo/Redo systems.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 1.1 KB |
| assets/code/HotbarMementoExample.cs.txt | markdown | 1.1 KB |
| assets/code/IMemento.cs.txt | markdown | 634 B |
| assets/code/LoadoutManager.cs.txt | markdown | 1.1 KB |
| references/guide.md | markdown | 1.2 KB |
assets/code/LoadoutManager.cs.txt
View on GitHubusing System.Collections.Generic;
using UnityEngine;
namespace Standard.Patterns.Memento {
/// <summary>
/// Acts as the Caretaker. Stores and manages snapshots for a specific Originator.
/// Ideal for Loadout systems and Checkpoints.
/// </summary>
public class LoadoutManager<T> {
private readonly List<IMemento<T>> _mementos = new();
private readonly IOriginator<T> _originator;
public LoadoutManager(IOriginator<T> originator) {
_originator = originator;
}
public void Save(int index) {
var memento = _originator.Save();
if (index >= _mementos.Count) {
_mementos.Add(memento);
} else {
_mementos[index] = memento;
}
Debug.Log($"[Memento] Status: Saved Loadout {index}");
}
public void Load(int index) {
if (index >= 0 && index < _mementos.Count) {
_originator.Restore(_mementos[index]);
Debug.Log($"[Memento] Status: Loaded Loadout {index}");
}
}
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |