Class UnityTransformDistanceScoreMeter
Gameplay MonoBehaviour that feeds a Score metric from how far a UnityEngine.Transform has travelled, so a designer can wire "score for moving" with zero code.
Namespace: Serenity.Score.Infrastructure.Components
Assembly: Serenity.UnityScore.Infrastructure.dll
Syntax
public class UnityTransformDistanceScoreMeter : MonoBehaviour
Remarks
The metric this meter feeds must already be registered — declared on a
UnityScoreSettings asset and installed
through the InstallScore pipeline task. This component never calls
Register(ScoreKey, ScoreMetricKind) itself: a second Register call on an
already-registered key zeroes any value accumulated so far, so registration has exactly one
owner (the installer). Until the key is registered, travel is not buffered — it is simply not
measured, and the origin is continuously re-seeded so the first valid frame only awards the
delta since registration, not the whole pre-registration travel.
Movement is read wherever Serenity.Score.Infrastructure.Components.UnityTransformDistanceScoreMeter.Update runs. A UnityEngine.Rigidbody moved from
FixedUpdate is interpolated between physics steps, so UnityEngine.Transform.position
read here already reflects that interpolation — there is no separate FixedUpdate mode.
Constructors
UnityTransformDistanceScoreMeter()
Declaration
public UnityTransformDistanceScoreMeter()
Properties
AccumulatedDistance
Total measured distance this meter has awarded, in raw meters (before Serenity.Score.Infrastructure.Components.UnityTransformDistanceScoreMeter.scorePerUnit).
Declaration
public float AccumulatedDistance { get; }
Property Value
| Type | Description |
|---|---|
| float |