.claude/skills/floatingtext-module/SKILL.md
FloatingTextModule reference — pooled floating damage/reward text with DOTween animations, builder pattern, lifecycle events, reactive pool stats, and configurable animation modes. Use when implementing floating text, damage numbers, or reward popups.
npx skillsauth add punkfuncgames/tetris-clone floatingtext-moduleInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Package: com.punkfuncgames.floatingtext | Define: PUNKFUNC_FLOATING_TEXT
Location: Packages/com.punkfuncgames.floatingtext/Runtime/PunkFuncGames.FloatingText/
Namespace: PunkFuncGames.FloatingText
Publish a FloatingTextEvent via MessagePipe — the FloatingTextService handles pooling and display.
_publisher.Publish(FloatingTextEvent.Simple(position, "+100 Gold", Color.yellow));
_publisher.Publish(new FloatingTextEvent.Builder(position, "+500")
.WithColor(Color.green)
.WithDuration(1.5f)
.WithMoveDistance(2f)
.WithDirection(Vector3.up)
.WithScaleMultiplier(1.5f)
.WithRotation(new Vector3(0, 0, 15))
.WithRotationAnimation(true)
.Build());
_floatingTextService.Spawn(FloatingTextEvent.Simple(position, "Direct"));
Interface: IFloatingTextService (in Service/IFloatingTextService.cs)
Implementation: FloatingTextService (in Service/FloatingTextService.cs)
| Member | Type | Description |
|--------|------|-------------|
| ActiveCount | ReadOnlyReactiveProperty<int> | Currently active floating texts |
| PoolSize | ReadOnlyReactiveProperty<int> | Number of pooled (inactive) views |
| IsInitialized | bool | Whether StartAsync has completed |
| Spawn(FloatingTextEvent) | void | Manually spawn (ignored if not initialized) |
Implements: IAsyncStartable — StartAsync(CancellationToken) subscribes to events and prewarms pool
Dependencies (constructor injection):
ISubscriber<FloatingTextEvent> — event subscriptionIPublisher<FloatingTextSpawnedEvent> — lifecycle: text spawnedIPublisher<FloatingTextCompletedEvent> — lifecycle: text completedIPublisher<FloatingTextPoolExhaustedEvent> — lifecycle: pool fullFloatingTextConfig — animation/pool configFloatingTextView — prefab for instantiationFields: Position, Text, Color?, SpawnOffset?, SpawnRadius?, Direction?, MoveDistance?, Duration?, EaseType?, Overshoot?, ScaleMultiplier?, PunchStrength?, Rotation?, AnimateRotation?
All nullable fields override config defaults when set.
| Event | Fields | When Published |
|-------|--------|----------------|
| FloatingTextSpawnedEvent | Position, Text, ActiveCount | After view gets from pool |
| FloatingTextCompletedEvent | Position, Text, Duration | After animation completes |
| FloatingTextPoolExhaustedEvent | MaxPoolSize, AttemptedText | When pool is full |
FloatingTextConfig (ScriptableObject): Thin wrapper with public FloatingTextConfigData data;
Access fields via _config.data.fieldName.
FloatingTextConfigData ([Serializable] public struct, camelCase fields):
67 serialized fields across categories: Space, Spawn Settings, Movement, Timing, Easing, Scale Animation, Rotation, Fade, Appearance, Pooling.
Enums (in Model/FloatingTextEnums.cs):
SpawnOffsetMode — None, UnitSphere, CustomPivotDirectionMode — Up, Down, Left, Right, Forward, Backward, Random, CustomScaleAnimationMode — None, Smooth, Punch, Elastic, PopRotationMode — None, Fixed, RandomPerSpawnSpaceMode — World, ScreenTest creation (no CreateRuntime factory):
FloatingTextConfig config = ScriptableObject.CreateInstance<FloatingTextConfig>();
config.data = new FloatingTextConfigData
{
duration = 1f,
moveDistance = 2f,
defaultColor = Color.white,
prewarmCount = 5,
maxPoolSize = 20
};
Immutable runtime context created via FloatingTextContext.Create(config, evt, random?). Merges config defaults with event overrides and evaluates randomized values at spawn time.
27 fields: Position, Text, Color, SpaceMode, SpawnOffset, Direction, MoveDistance, Duration, EaseType, Overshoot, Amplitude, Period, ScaleMode, ScaleMultiplier, ScaleDuration, PunchStrength, PunchVibrato, PunchElasticity, InitialRotation, AnimateRotation, RotationAnimation, FadeStartTime, FadeDuration, UseGradient, ColorGradient, UseOutline, OutlineColor, OutlineThickness
NoneScaleStrategy — no scalingSmoothScaleStrategy — Yoyo scale with OutBack easePunchScaleStrategy — DOPunchScale with vibratoElasticScaleStrategy — OutElastic scale up, then ease downPopScaleStrategy — fast OutBack pop, slow OutElastic settleFactory: ScaleAnimationStrategyFactory.Create(ScaleAnimationMode) — returns singleton instances
SetCamera(Camera) — inject camera for screen space mode (falls back to Camera.main)Initialize() — setup material instance, cache originals, deactivatePlay(FloatingTextContext, Action) — run animation, callback on completeResetView() — kill tweens, reset transform/alpha, deactivateFloatingTextInstaller.Install(builder, options, config, prefab);
Registers:
FloatingTextService as IFloatingTextService and self (entry point)FloatingTextConfig and FloatingTextView prefab as instancesFloatingTextEvent, FloatingTextSpawnedEvent, FloatingTextCompletedEvent, FloatingTextPoolExhaustedEventpublic sealed class DamageDisplay : IDisposable
{
private readonly IPublisher<FloatingTextEvent> _publisher;
private readonly CompositeDisposable _disposables = new();
public DamageDisplay(
IPublisher<FloatingTextEvent> publisher,
ISubscriber<DamageEvent> damageSubscriber)
{
_publisher = publisher;
damageSubscriber.Subscribe(OnDamage).AddTo(_disposables);
}
private void OnDamage(DamageEvent evt)
{
_publisher.Publish(new FloatingTextEvent.Builder(evt.Position, $"-{evt.Amount}")
.WithColor(evt.IsCritical ? Color.red : Color.white)
.WithScaleMultiplier(evt.IsCritical ? 2f : 1f)
.Build());
}
public void Dispose() => _disposables.Dispose();
}
EditMode Tests: Packages/com.punkfuncgames.floatingtext/Tests/EditMode/
PlayMode Tests: Packages/com.punkfuncgames.floatingtext/Tests/PlayMode/
development
WalletModule reference — currency management with BigDouble support, reactive properties, caps, lifetime stats, and persistence. Use when working with currencies, wallets, or financial systems.
development
UnlockConditionModule reference — composable unlock conditions using ScriptableObjects with AND/OR/NOT logic, stat/currency/upgrade/prestige/gamestate/boolean checks, reactive service layer with progress tracking. Use when implementing unlock systems, gating, or progression requirements.
development
UndoModule reference — command pattern with undo/redo stacks, command merging, and reactive state. Use when implementing undo/redo, undoable actions, or command patterns.
tools
Unity UI Toolkit reference — UXML documents, USS styling, MVVM pattern (ViewModel + Presenter), custom VisualElements, responsive layout, animations, performance guidelines, and complete Figma-to-UI-Toolkit property mapping. Use when building or modifying UI with UI Toolkit, creating UXML/USS files, writing ViewModels or Presenters, designing screens/panels/components, or converting Figma designs to UI Toolkit.