replace music system by sound system

This commit is contained in:
Askou
2021-06-07 11:46:27 +02:00
parent 8e93e84006
commit fb9e5710b1
3 changed files with 33 additions and 33 deletions
@@ -0,0 +1,26 @@
//
// Created by Tom Augier on 05/06/2021
//
#include "PlayerSoundManagerSystem.hpp"
namespace BBM {
void SoundManagerSystem::onFixedUpdate(WAL::Entity &entity)
{
if (!entity.hasComponent<ControllableComponent>())
return;
const auto &controllable = entity.getComponent<ControllableComponent>();
auto &sound = entity.getComponent<SoundComponent>();
auto &health = entity.getComponent<HealthComponent>();
sound.setIndex(SoundComponent::BOMB);
controllable.bomb ? sound.loadSound() : sound.unloadSound();
sound.setIndex(SoundComponent::JUMP);
controllable.jump ? sound.loadSound() : sound.unloadSound();
sound.setIndex(SoundComponent::MOVE);
(controllable.move.x != 0 || controllable.move.y != 0) ? sound.loadSound() : sound.unloadSound();
sound.setIndex(SoundComponent::DEATH);
health.getHealthPoint() == 0 ? sound.loadSound() : sound.unloadSound();
}
}