mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 00:01:54 +08:00
add basic outline of audio for room
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
-2
@@ -51,7 +51,7 @@ var AudioEngine = {
|
||||
}
|
||||
|
||||
// fade in new track
|
||||
var fadeTime = this.audioContext.currentTime + 5.0;
|
||||
var fadeTime = this.audioContext.currentTime + 2.0;
|
||||
newTrack.connect(this.tracks[nextBackgroundChannel]);
|
||||
newTrack.start(0);
|
||||
this.tracks[nextBackgroundChannel].gain.setValueAtTime(0.0, this.audioContext.currentTime);
|
||||
@@ -60,7 +60,7 @@ var AudioEngine = {
|
||||
// fade out old track
|
||||
this.tracks[this.currentBackgroundChannel].gain.linearRampToValueAtTime(0.0, fadeTime);
|
||||
if (this.currentTrack) {
|
||||
this.currentTrack.stop(fadeTime + 1.0); // make sure fade has completed
|
||||
this.currentTrack.stop(fadeTime + 0.3); // make sure fade has completed
|
||||
}
|
||||
|
||||
// switch background track
|
||||
|
||||
+3
-4
@@ -72,10 +72,10 @@
|
||||
|
||||
options: {
|
||||
state: null,
|
||||
debug: false,
|
||||
log: false,
|
||||
debug: true,
|
||||
log: true,
|
||||
dropbox: false,
|
||||
doubleTime: false
|
||||
doubleTime: true
|
||||
},
|
||||
|
||||
init: function(options) {
|
||||
@@ -597,7 +597,6 @@
|
||||
Engine.activeModule = module;
|
||||
module.onArrival(diff);
|
||||
Notifications.printQueue(module);
|
||||
AudioEngine.changeMusic(module.music);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
var Outside = {
|
||||
name: _("Outside"),
|
||||
music: '/audio/outside.wav',
|
||||
|
||||
_STORES_OFFSET: 0,
|
||||
_GATHER_DELAY: 60,
|
||||
|
||||
+41
-2
@@ -8,9 +8,19 @@ var Room = {
|
||||
_BUILDER_STATE_DELAY: 0.5 * 60 * 1000, // time between builder state updates
|
||||
_STOKE_COOLDOWN: 10, // cooldown to stoke the fire
|
||||
_NEED_WOOD_DELAY: 15 * 1000, // from when the stranger shows up, to when you need wood
|
||||
|
||||
currentMusic: 0,
|
||||
MUSIC: {
|
||||
0: '/audio/fire-0.wav',
|
||||
1: '/audio/fire-1.wav',
|
||||
2: '/audio/fire-2.wav',
|
||||
3: '/audio/fire-3.wav',
|
||||
4: '/audio/fire-4.wav',
|
||||
},
|
||||
SOUNDS: {
|
||||
'light-fire': '/audio/light-fire.wav',
|
||||
'stoke-fire': '/audio/stoke-fire.wav'
|
||||
},
|
||||
buttons: {},
|
||||
music: '/audio/room.wav',
|
||||
Craftables: {
|
||||
'trap': {
|
||||
name: _('trap'),
|
||||
@@ -566,6 +576,7 @@ var Room = {
|
||||
}
|
||||
|
||||
Engine.moveStoresView(null, transition_diff);
|
||||
Room.setMusic();
|
||||
},
|
||||
|
||||
TempEnum: {
|
||||
@@ -646,6 +657,7 @@ var Room = {
|
||||
$SM.set('stores.wood', wood - 5);
|
||||
}
|
||||
$SM.set('game.fire', Room.FireEnum.Burning);
|
||||
AudioEngine.playSound(Room.SOUNDS['light-fire']);
|
||||
Room.onFireChange();
|
||||
},
|
||||
|
||||
@@ -662,6 +674,7 @@ var Room = {
|
||||
if ($SM.get('game.fire.value') < 4) {
|
||||
$SM.set('game.fire', Room.FireEnum.fromInt($SM.get('game.fire.value') + 1));
|
||||
}
|
||||
AudioEngine.playSound(Room.SOUNDS['stoke-fire']);
|
||||
Room.onFireChange();
|
||||
},
|
||||
|
||||
@@ -679,6 +692,10 @@ var Room = {
|
||||
Room._fireTimer = Engine.setTimeout(Room.coolFire, Room._FIRE_COOL_DELAY);
|
||||
Room.updateButton();
|
||||
Room.setTitle();
|
||||
|
||||
if ($SM.get('game.fire.value') !== Room.currentMusic) {
|
||||
Room.setMusic();
|
||||
}
|
||||
},
|
||||
|
||||
coolFire: function () {
|
||||
@@ -1170,5 +1187,27 @@ var Room = {
|
||||
} else if (e.stateName.indexOf('game.buildings') === 0) {
|
||||
Room.updateBuildButtons();
|
||||
}
|
||||
},
|
||||
|
||||
setMusic: function () {
|
||||
var fireValue = $SM.get('game.fire.value');
|
||||
switch (fireValue) {
|
||||
case 0:
|
||||
AudioEngine.changeMusic(Room.MUSIC[fireValue]);
|
||||
break;
|
||||
case 1:
|
||||
AudioEngine.changeMusic(Room.MUSIC[fireValue]);
|
||||
break;
|
||||
case 2:
|
||||
AudioEngine.changeMusic(Room.MUSIC[fireValue]);
|
||||
break;
|
||||
case 3:
|
||||
AudioEngine.changeMusic(Room.MUSIC[fireValue]);
|
||||
break;
|
||||
case 4:
|
||||
AudioEngine.changeMusic(Room.MUSIC[fireValue]);
|
||||
break;
|
||||
}
|
||||
Room.currentMusic = fireValue;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user