MuharremTozan/Agentic-Duel / .agent/skills/unity-fsm
unity-fsm
VerifiedSpecialized skill for implementing a robust, extensible Finite State Machine in Unity using the State and Strategy patterns. Based on the pattern by Adam Myhre (3D Platformer). Use when creating complex AI, player controllers, or any system requiring structured state management.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 1.7 KB |
| assets/code/ActionState.cs.txt | markdown | 793 B |
| assets/code/BaseState.cs.txt | markdown | 950 B |
| assets/code/ConeDetectionStrategy.cs.txt | markdown | 1.1 KB |
| assets/code/Enemy.cs.txt | markdown | 2.1 KB |
| assets/code/EnemyBaseState.cs.txt | markdown | 1004 B |
| assets/code/FuncPredicate.cs.txt | markdown | 281 B |
| assets/code/IDetectionStrategy.cs.txt | markdown | 192 B |
| assets/code/IPredicate.cs.txt | markdown | 90 B |
| assets/code/IState.cs.txt | markdown | 179 B |
| assets/code/ITransition.cs.txt | markdown | 131 B |
| assets/code/PlayerDetector.cs.txt | markdown | 2.0 KB |
| assets/code/StateMachine.cs.txt | markdown | 2.5 KB |
| assets/code/Timer.cs.txt | markdown | 1.9 KB |
| assets/code/Transition.cs.txt | markdown | 282 B |
| references/enemy-ai.md | markdown | 1.8 KB |
| references/guide.md | markdown | 2.3 KB |
assets/code/Timer.cs.txt
View on GitHubusing System;
namespace Utilities {
public abstract class Timer {
protected float initialTime;
protected float Time { get; set; }
public bool IsRunning { get; protected set; }
public float Progress => Time / initialTime;
public Action OnTimerStart = delegate { };
public Action OnTimerStop = delegate { };
protected Timer(float value) {
initialTime = value;
IsRunning = false;
}
public virtual void Start() {
Time = initialTime;
if (!IsRunning) {
IsRunning = true;
OnTimerStart.Invoke();
}
}
public void Stop() {
if (IsRunning) {
IsRunning = false;
OnTimerStop.Invoke();
}
}
public void Resume() => IsRunning = true;
public void Pause() => IsRunning = false;
public abstract void Tick(float deltaTime);
}
public class CountdownTimer : Timer {
public CountdownTimer(float value) : base(value) { }
public override void Tick(float deltaTime) {
if (IsRunning && Time > 0) {
Time -= deltaTime;
}
if (IsRunning && Time <= 0) {
Stop();
}
}
public bool IsFinished => Time <= 0;
public void Reset() => Time = initialTime;
public void Reset(float newTime) {
initialTime = newTime;
Reset();
}
}
public class StopwatchTimer : Timer {
public StopwatchTimer() : base(0) { }
public override void Tick(float deltaTime) {
if (IsRunning) {
Time += deltaTime;
}
}
public void Reset() => Time = 0;
public float GetTime() => Time;
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |