mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-07 11:34:46 +00:00
replace music system by sound system
This commit is contained in:
@@ -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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user