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/HotbarMementoExample.cs.txt
View on GitHubusing System.Collections.Generic;
using UnityEngine;
namespace Standard.Patterns.Memento.Examples {
/// <summary>
/// Represents an Item/Ability that can be in a Hotbar.
/// </summary>
public class HotbarItem : ScriptableObject {
public string Name;
public Sprite Icon;
}
/// <summary>
/// The Originator: A Hotbar system that can snapshot its slots.
/// </summary>
public class HotbarSystem : MonoBehaviour, IOriginator<List<HotbarItem>> {
[SerializeField] private List<HotbarItem> currentSlots = new();
public IMemento<List<HotbarItem>> Save() {
// Important: Create a new list to ensure the snapshot is immutable
return new Memento<List<HotbarItem>>(new List<HotbarItem>(currentSlots));
}
public void Restore(IMemento<List<HotbarItem>> memento) {
currentSlots = new List<HotbarItem>(memento.State);
UpdateUI();
}
private void UpdateUI() {
Debug.Log("[Hotbar] Status: UI Updated with restored state.");
}
}
}
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 |