Game Development Reference
In-Depth Information
"fs_sand1.wav",
"fs_sand2.wav",
"fs_sand3.wav"
]
},
{
"switch": "grass",
"sources":
[
"fs_grass1.wav",
"fs_grass2.wav",
"fs_grass3.wav"
]
}
]
}
It's certainly possible to just add this additional functionality to the SoundCue
class. A more preferable solution, however, would be to have an ISoundCue
interface that is implemented by both SoundCue and a new Switch-
ableSoundCue class:
Click here to view code image
interface ISoundCue
function Play()
end
class SwitchableSoundCue implements ISoundCue
string name
int falloff
int priority
string switch_name
// Hash Map that stores (string,List) pairs
// For example ("sand", ["fs_sand1.wav",
"fs_sand2.wav", "fs_sand3.
wav"])
HashMap sources
Search WWH ::




Custom Search