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
@@ -1,26 +0,0 @@
//
// Created by Tom Augier on 05/06/2021
//
#include "PlayerMusicManagerSystem.hpp"
namespace BBM {
void MusicManagerSystem::onFixedUpdate(WAL::Entity &entity)
{
if (!entity.hasComponent<ControllableComponent>())
return;
const auto &controllable = entity.getComponent<ControllableComponent>();
auto &music = entity.getComponent<MusicComponent>();
auto &health = entity.getComponent<HealthComponent>();
music.setIndex(MusicComponent::BOMB);
controllable.bomb ? music.loadMusic() : music.unloadMusic();
music.setIndex(MusicComponent::JUMP);
controllable.jump ? music.loadMusic() : music.unloadMusic();
music.setIndex(MusicComponent::MOVE);
(controllable.move.x != 0 || controllable.move.y != 0) ? music.loadMusic() : music.unloadMusic();
music.setIndex(MusicComponent::DEATH);
health.getHealthPoint() == 0 ? music.loadMusic() : music.unloadMusic();
}
}
@@ -1,31 +0,0 @@
//
// Created by Tom Augier on 05/06/2021
//
#pragma once
#include "System/System.hpp"
#include "Window.hpp"
#include "Component/Music/MusicComponent.hpp"
#include "Component/Health/HealthComponent.hpp"
#include <Component/Controllable/ControllableComponent.hpp>
#include "Wal.hpp"
namespace BBM
{
class MusicManagerSystem : public WAL::System
{
public:
//! @inherit
void onFixedUpdate(WAL::Entity &entity) override;
//! @brief ctor
MusicManagerSystem(WAL::Wal &wal, RAY::Window &window);
//! @brief Default copy ctor
MusicManagerSystem(const MusicManagerSystem &) = default;
//! @brief Default dtor
~MusicManagerSystem() override = default;
//! @brief A MusicManager screen system can't be assigned.
MusicManagerSystem &operator=(const MusicManagerSystem &) = delete;
};
}