mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 07:58:05 +02:00
AC ambiance script / moved AC scripts to new directory
This commit is contained in:
parent
1443cece5b
commit
44190b6fde
3 changed files with 42 additions and 0 deletions
42
examples/acScripts/ambiance.js
Normal file
42
examples/acScripts/ambiance.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// ambiance.js
|
||||
// examples
|
||||
//
|
||||
// Created by Clément Brisset on 11/18/14.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
var soundURL = "https://s3.amazonaws.com/hifi-public/sounds/08_Funny_Bone.wav";
|
||||
var position = { x: 700, y: 25, z: 725 };
|
||||
var audioOptions = {
|
||||
position: position,
|
||||
volume: 0.4,
|
||||
loop: true,
|
||||
stereo: false
|
||||
};
|
||||
|
||||
var sound = SoundCache.getSound(soundURL, audioOptions.isStereo);
|
||||
var injector = null;
|
||||
var count = 100;
|
||||
|
||||
Script.update.connect(function() {
|
||||
if (count > 0) {
|
||||
count--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sound.downloaded && injector === null) {
|
||||
print("Sound downloaded.");
|
||||
injector = Audio.playSound(sound, audioOptions);
|
||||
print("Playing: " + injector);
|
||||
}
|
||||
});
|
||||
|
||||
Script.scriptEnding.connect(function() {
|
||||
if (injector !== null) {
|
||||
injector.stop();
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue