Listener

From Unify Community Wiki
Revision as of 18:12, 23 April 2009 by Jessy (Talk | contribs)

Jump to: navigation, search

JavaScript - Listener.js

<javascript>@script RequireComponent(AudioListener)

var volume : float = 1;

// determines whether "RefreshVolume" will run in Update(), // or must be called manually var performanceMode = false;

private var loudnessExponent = Mathf.Log(Mathf.Sqrt(10), 2);

function RefreshVolume () {audioListener.volume = Mathf.Pow(volume, loudnessExponent);}

function Start () {RefreshVolume ();}

function Update () {if (performanceMode == false) RefreshVolume ();}</javascript>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox