This commit is contained in:
16
src/resource/xml/sound_entry.cpp
Normal file
16
src/resource/xml/sound_entry.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "sound_entry.hpp"
|
||||
|
||||
#include "../../util/vector.hpp"
|
||||
|
||||
namespace game::resource::xml
|
||||
{
|
||||
Audio& SoundEntryCollection::get()
|
||||
{
|
||||
return at(util::vector::random_index_weighted(*this, [](const auto& entry) { return entry.weight; })).sound;
|
||||
}
|
||||
|
||||
void SoundEntryCollection::play()
|
||||
{
|
||||
at(util::vector::random_index_weighted(*this, [](const auto& entry) { return entry.weight; })).play();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user