codecombat/app/lib/scripts/SoundScriptModule.coffee

35 lines
808 B
CoffeeScript
Raw Normal View History

2014-01-03 13:32:13 -05:00
ScriptModule = require './ScriptModule'
currentMusic = null
standingBy = null
{me} = require('core/auth')
2014-01-03 13:32:13 -05:00
module.exports = class SoundScriptModule extends ScriptModule
@neededFor: (noteGroup) ->
return noteGroup.sound?
startNotes: ->
notes = []
notes.push(@addSuppressSelectionSoundsNote()) if @noteGroup.sound.suppressSelectionSounds?
notes.push(@addMusicNote()) if @noteGroup.sound.music?
return notes
endNotes: ->
return []
skipNotes: ->
return @startNotes()
addSuppressSelectionSoundsNote: ->
note =
channel: 'level:suppress-selection-sounds'
2014-01-03 13:32:13 -05:00
event: {suppress: @noteGroup.sound.suppressSelectionSounds}
return note
2014-06-30 22:16:26 -04:00
2014-01-03 13:32:13 -05:00
addMusicNote: ->
note =
channel: 'music-player:play-music'
2014-01-03 13:32:13 -05:00
event: @noteGroup.sound.music
return note