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
Update takes an increment flag: true accumulates, false overwrites.
Fields
value
Current value of the metric.
Declaration
public float value
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Unit depends on the metric: meters, seconds or m/s.
Methods
Reset()
Resets the metric value to zero.
Declaration
public void Reset()
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
increment=true for cumulative metrics (distance, time), false for instantaneous ones.
Update(float, bool)
Updates the metric with an already calculated value.
Declaration
public void Update(float v, bool increment)
Parameters
| Type | Name | Description |
|---|---|---|
| float | v | The value to apply to the metric. |
| bool | increment | If true, adds to current value. If false, replaces value. |