mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-10 20:41:21 +00:00
fix merge + convert audio ressources + add sounds/music to scenes
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by Tom Augier on 05/06/2021
|
||||
//
|
||||
|
||||
#include "MenuSoundManagerSystem.hpp"
|
||||
#include <map>
|
||||
|
||||
namespace BBM {
|
||||
|
||||
MenuSoundManagerSystem::MenuSoundManagerSystem(WAL::Wal &wal)
|
||||
: System(wal)
|
||||
{}
|
||||
|
||||
void MenuSoundManagerSystem::onFixedUpdate(WAL::ViewEntity<SoundComponent, ControllableComponent> &entity)
|
||||
{
|
||||
const auto &controllable = entity.get<ControllableComponent>();
|
||||
auto &sound = entity.get<SoundComponent>();
|
||||
|
||||
sound.setVolume(sound.volume);
|
||||
std::map<bool, SoundComponent::SoundIndex> soundIndex = {
|
||||
{controllable.move.x, SoundComponent::MOVE},
|
||||
{controllable.move.y, SoundComponent::MOVE},
|
||||
{controllable.jump, SoundComponent::JUMP},
|
||||
};
|
||||
for (auto &a : soundIndex) {
|
||||
if (a.first) {
|
||||
sound.setIndex(a.second);
|
||||
sound.playSound();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user