Loot 3 group A: the grab is presented, not simulated

IGrabPresenter.Grab(GrabEvent) only; the binder's Transform and velocity resolvers go. TractorBeam
presents a running grab (aims at Started's TargetPosition, emits at Power, dark otherwise). FieldDriver
draws its tendril from GrabEvents alone with a real-time phase clock over each event's PhaseDuration and
writes no transform and destroys nothing; its grab times move to FieldTester, now the scene's stand-in sim
that owns its pickup's timeline and pose. ItemPickup keeps its label lit while held. ImpactPresenterSmoke
becomes CapabilityPresentationSmoke with a grab section; its two untracked-ship expectations follow
DrawsAt since contact-hud. Builds (Unity 6000.3.24f1 batchmode: smoke ok, scene opens, no missing script).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-13 18:43:15 +02:00
commit 48b42992ee
9 changed files with 232 additions and 166 deletions

View file

@ -8,27 +8,18 @@ using UnityEngine;
// playground-cut.md fork L: "presentation is chosen per item, independently of capability... one
// presentation... can visualize any subset of an item's capabilities"). This binder has no knowledge
// of FieldDriver or any other concrete presentation, and no knowledge of what publishes events --
// today the FieldShieldTest scene calls Bind() directly; a real capability owner will do the same
// later without this binder changing.
// EntityInstance binds every entity's events, and the FieldShieldTest scene binds its stand-in sim's the same way.
public class CapabilityPresentationBinder : MonoBehaviour
{
private readonly List<IDisposable> _subscriptions = new List<IDisposable>();
private Func<FloatingBodyId, Transform> _grabTargetResolver;
private Func<FloatingBodyId, Vector3> _grabInitialVelocityResolver;
// Subscribes every presenter interface implemented by components on this object or its children to
// the matching stream of `events`. `grabTargetResolver`/`grabInitialVelocityResolver` resolve a
// GrabEvent's target id to the live Transform/velocity a grab presenter needs; the owner
// of `events` supplies them (the test scene today; the real pickup capability's caller later).
public void Bind(CapabilityEvents events, Func<FloatingBodyId, Transform> grabTargetResolver = null,
Func<FloatingBodyId, Vector3> grabInitialVelocityResolver = null)
// the matching stream of `events`.
public void Bind(CapabilityEvents events)
{
Unbind();
if (events == null) return;
_grabTargetResolver = grabTargetResolver;
_grabInitialVelocityResolver = grabInitialVelocityResolver;
foreach (var presenter in GetComponentsInChildren<IAbsorbPresenter>(true))
{
var p = presenter;
@ -38,12 +29,7 @@ public class CapabilityPresentationBinder : MonoBehaviour
foreach (var presenter in GetComponentsInChildren<IGrabPresenter>(true))
{
var p = presenter;
_subscriptions.Add(events.Grab.Subscribe(e =>
{
var target = _grabTargetResolver?.Invoke(e.Target);
var velocity = _grabInitialVelocityResolver?.Invoke(e.Target) ?? Vector3.zero;
p.Grab(e, target, velocity);
}));
_subscriptions.Add(events.Grab.Subscribe(e => p.Grab(e)));
}
foreach (var presenter in GetComponentsInChildren<IMeleePresenter>(true))
@ -63,8 +49,6 @@ public class CapabilityPresentationBinder : MonoBehaviour
{
foreach (var s in _subscriptions) s.Dispose();
_subscriptions.Clear();
_grabTargetResolver = null;
_grabInitialVelocityResolver = null;
}
private void OnDisable() => Unbind();