// // Created by Tom Augier on 05/06/2021 // #include "MenuSoundManagerSystem.hpp" #include namespace BBM { MenuSoundManagerSystem::MenuSoundManagerSystem(WAL::Wal &wal) : System(wal) {} void MenuSoundManagerSystem::onFixedUpdate(WAL::ViewEntity &entity) { const auto &controllable = entity.get(); auto &sound = entity.get(); sound.setVolume(sound.volume); std::map soundIndex = { {controllable.move.x, SoundComponent::MOVE}, {controllable.move.y, SoundComponent::MOVE}, {controllable.bomb, SoundComponent::BOMB}, }; for (auto &a : soundIndex) { if (a.first) { sound.setIndex(a.second); sound.playSound(); } } } }