Class MetricsModule.Metric
Container class for individual metric values with update logic.
Namespace: NWH.VehiclePhysics2.Modules.Metrics
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class MetricsModule.Metric
Remarks
Encapsulates a single metric value with methods for updating and resetting. Supports both incremental updates (for cumulative metrics) and absolute updates (for peak values).
Fields
value
Current value of the metric.
Declaration
public float value
Field Value
| Type | Description |
|---|---|
| float |
Remarks
The unit depends on the specific metric (meters, seconds, m/s, etc.). Access this value for display or gameplay logic.
Methods
Reset()
Resets the metric value to zero.
Declaration
public void Reset()
Remarks
Call this to clear statistics, start new sessions, or implement checkpoint systems.
Update(UpdateDelegate, bool)
Updates the metric value using the provided delegate.
Declaration
public void Update(MetricsModule.Metric.UpdateDelegate del, bool increment)
Parameters
| Type | Name | Description |
|---|---|---|
| MetricsModule.Metric.UpdateDelegate | del | Delegate that calculates the update value. |
| bool | increment | If true, adds to current value. If false, replaces value. |
Remarks
Use increment=true for cumulative metrics (distance, time). Use increment=false for instantaneous metrics (speed, position).