add Sound component

This commit is contained in:
Askou
2021-06-07 12:33:18 +02:00
parent fb9e5710b1
commit a0ea2576a5
5 changed files with 11 additions and 5 deletions
+4 -2
View File
@@ -69,8 +69,10 @@ set(SOURCES
sources/System/Collision/CollisionSystem.cpp
sources/Component/Music/MusicComponent.cpp
sources/Component/Music/MusicComponent.hpp
sources/System/Music/PlayerMusicManagerSystem.cpp
sources/System/Music/PlayerMusicManagerSystem.hpp
sources/Component/Sound/SoundComponent.hpp
sources/Component/Sound/SoundComponent.cpp
sources/System/Sound/PlayerSoundManagerSystem.cpp
sources/System/Sound/PlayerSoundManagerSystem.hpp
)
add_executable(bomberman
sources/main.cpp
Binary file not shown.
Binary file not shown.
@@ -20,6 +20,9 @@ std::map<SoundComponent::soundIndex, std::string> &soundPath)
this->_soundList[static_cast<soundIndex>(i)] = RAY::Audio::Sound(soundPath.at(static_cast<soundIndex>(i)));
}
}
/*for (int i = 0; i < DEATH + 1; i++) {
std::cout << i << this->_isLoad.at(static_cast<soundIndex>(i)) << soundPath.at(static_cast<soundIndex>(i)) << std::endl;
}*/
}
SoundComponent::SoundComponent(WAL::Entity &entity)
@@ -35,6 +38,7 @@ std::map<SoundComponent::soundIndex, std::string> &soundPath)
void SoundComponent::loadSound(void)
{
std::cout << this->_soundIndex << std::endl;
if (!this->_isLoad.at(this->_soundIndex))
return;
if (!this->_soundList[this->_soundIndex].isPlaying()) {
+3 -3
View File
@@ -66,11 +66,11 @@ namespace BBM
std::shared_ptr<WAL::Scene> loadGameScene()
{
auto scene = std::make_shared<WAL::Scene>();
std::map<SoundComponent::soundIndex, std::string> musicPath= {
std::map<SoundComponent::soundIndex, std::string> soundPath= {
{SoundComponent::IDLE, ""},
{SoundComponent::JUMP, ""},
{SoundComponent::BOMB, ""},
{SoundComponent::MOVE, "assets/sounds/new_death.ogg"},
{SoundComponent::MOVE, "assets/sounds/weird.wav"},
{SoundComponent::HURT, ""},
{SoundComponent::THROW, ""},
{SoundComponent::DEATH, ""}
@@ -83,7 +83,7 @@ namespace BBM
.addComponent<AnimationsComponent>(RAY::ModelAnimations("assets/player/player.iqm"), 1)
.addComponent<CollisionComponent>(2)
.addComponent<MovableComponent>()
.addComponent<SoundComponent>(musicPath);
.addComponent<SoundComponent>(soundPath);
scene->addEntity("cube")
.addComponent<PositionComponent>(-5, 0, -5)
.addComponent<Drawable3DComponent, RAY3D::Cube>(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED)