Class EngineStartStopComponent
Starter and shutdown sounds, driven by the engine onStart/onStop events. Clip 0 is the start sound, pitched by cranking RPM; clip 1 is the optional shutdown sound.
Inherited Members
Namespace: NWH.VehiclePhysics2.Sound.SoundComponents
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class EngineStartStopComponent : SoundComponent
Fields
pitch
Base pitch multiplier for the start/stop sounds. Scaled by cranking speed while starting.
Declaration
[Range(0.1, 2)]
public float pitch
Field Value
| Type | Description |
|---|---|
| float |
Properties
AudioMixerGroup
Gets the Audio Mixer Group this component's AudioSource should output to. Used to route audio through the vehicle's audio mixer for processing and mixing.
Declaration
public override AudioMixerGroup AudioMixerGroup { get; }
Property Value
| Type | Description |
|---|---|
| AudioMixerGroup |
Overrides
ContainerGO
Gets the GameObject container where the AudioSource should be created. Used to position audio sources at specific locations on the vehicle.
Declaration
public override GameObject ContainerGO { get; }
Property Value
| Type | Description |
|---|---|
| GameObject |
Overrides
Priority
Gets the priority level for the AudioSource. Lower values indicate higher priority. Range is 0 (highest) to 256 (lowest). Used by Unity's audio system when the maximum number of audio sources is reached.
Declaration
public override int Priority { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Methods
PlayStarting()
Plays the engine starting sound (clip at index 0). Automatically called when the engine starts. With a starter the clip runs until the starter releases, otherwise for the configured startDuration.
Declaration
public virtual void PlayStarting()
PlayStopping()
Plays the engine stopping sound (clip at index 1) if available. Automatically called when the engine is turned off.
Declaration
public virtual void PlayStopping()
VC_Disable(bool)
Stops and disables the AudioSource belonging to this SoundComponent.
Declaration
public override bool VC_Disable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
VC_Enable(bool)
Enables the AudioSource belonging to this SoundComponent.
Declaration
public override bool VC_Enable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
VC_SetDefaults()
Writes default values into every serialized field, and may pull default assets from Resources. Runs on vehicle reset and when the component is first added.
Declaration
public override void VC_SetDefaults()
Overrides
VC_Update(float)
Per-frame update for input, visuals and UI. Only called while the component is active. Physics belongs in VC_FixedUpdate, not here.
Declaration
public override void VC_Update(float DeltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | DeltaTime | Time elapsed since last Update in seconds |