component.soundcomponent

Provides an entity with an ability to play sound effects.

struct SoundComponent;

Provides an entity with an ability to play sound effects.

struct PlayCondition;

A condition determining when to play a particular sound.

enum Type;

Type of playback condition.

Spawn

Played when the entity is spawned.

Burst

Played at burst of weapon specified by weaponIndex.

Hit

The entity is being hit by a warhead.

Better than adding a SoundComponent to projectiles even though that would be more powerful.
We can add a tag to this; i.e. only play this sound when hit by entity with tag X.

Type type;

Type of playback condition.

ubyte weaponIndex;

Index of the weapon used with Burst type. Type-specific data.

string sound;

Sound to play when the condition is met.

float volume;

Volume of the sound. Must be between 0 and 1.

float delay;

Delay between condition being met and sound being played.

alias PlayConditionArray;

Use an allocator to reduce reallocation.

PlayConditionArray playConditions;

Used when there is more than one weapon.

this(ref Node yaml);

Load from a YAML node. Throws YAMLException on error.