MuharremTozan/Agentic-Duel / .agent/skills/unity-command-pattern
unity-command-pattern
VerifiedEncapsulate actions as objects for queuing, undo/redo, and async execution.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 584 B |
| assets/code/Command.cs.txt | markdown | 1.3 KB |
| references/guide.md | markdown | 1.4 KB |
assets/code/Command.cs.txt
View on GitHubusing System.Threading.Tasks;
using UnityEngine;
namespace Standard.Patterns {
/// <summary>
/// Command interface with async support for sequential execution.
/// </summary>
public interface ICommand {
Task Execute();
}
/// <summary>
/// ScriptableObject-based command for data-driven actions.
/// Use this for simple, inspector-configurable commands.
/// </summary>
public abstract class CommandSO : ScriptableObject {
public abstract void Execute();
}
/// <summary>
/// Command invoker for queuing and executing commands sequentially.
/// </summary>
public class CommandQueue : MonoBehaviour {
private System.Collections.Generic.Queue<ICommand> _commands = new();
private bool _isExecuting;
public void Enqueue(ICommand command) {
_commands.Enqueue(command);
if (!_isExecuting) {
ExecuteNext();
}
}
private async void ExecuteNext() {
if (_commands.Count == 0) {
_isExecuting = false;
return;
}
_isExecuting = true;
ICommand command = _commands.Dequeue();
await command.Execute();
ExecuteNext();
}
}
}
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: 197k | 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 |