Skip to content

MuharremTozan/Agentic-Duel / .agent/skills/unity-memento-pattern

unity-memento-pattern

Verified

Implements the Memento pattern for capturing and restoring object states. Perfect for Loadout managers, Checkpoints, and Undo/Redo systems.

assets/code/LoadoutManager.cs.txt

View on GitHub
using 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}");
            }
        }
    }
}
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall