Skip to main content

TriggerSoundEmitter

A class in Root.Township, the global namespace.

A sphere trigger that plays a sound when something enters. Only the arrow woosh is handled: it plays when an arrow passes near the local player.

Constructors​

MemberWhat it is
TriggerSoundEmitter()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private SoundEffect soundThe sound effect to play.
private SphereCollider sphereColliderThe trigger sphere, set up from triggerRadius.
private float triggerRadiusRadius copied onto the sphere collider in the editor.

Methods​

2 private and internal methods
MemberWhat it is
private void OnTriggerEnter(Collider collider)Client: if the sound is ArrowWoosh and an arrow enters near the local player, plays it on the arrow.
private void OnValidate()Makes the sphere collider a trigger with radius triggerRadius.