Working sound system and most enemies have a sound effect. This will make it easier to add sounds now.
This commit is contained in:
parent
83df9ff03b
commit
20cbc3a21c
12 changed files with 126 additions and 5 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "lights.hpp"
|
||||
#include "inventory.hpp"
|
||||
#include "events.hpp"
|
||||
#include "sound.hpp"
|
||||
|
||||
using std::string;
|
||||
using namespace fmt;
|
||||
|
@ -133,6 +134,10 @@ void System::death(GameLevel &level, components::ComponentMap& components) {
|
|||
world.remove<EnemyConfig>(ent);
|
||||
world.remove<Animation>(ent);
|
||||
|
||||
if(auto snd = world.get_if<Sound>(ent)) {
|
||||
sound::play(snd->death);
|
||||
}
|
||||
|
||||
auto entity_data = config.items["GRAVE_STONE"];
|
||||
components::configure_entity(components, world, ent, entity_data["components"]);
|
||||
if(entity_data["inventory_count"] > 0) {
|
||||
|
@ -167,6 +172,10 @@ void System::combat(GameLevel &level) {
|
|||
animation.play();
|
||||
}
|
||||
|
||||
if(auto snd = world.get_if<Sound>(entity)) {
|
||||
sound::play(snd->attack);
|
||||
}
|
||||
|
||||
world.send<Events::GUI>(Events::GUI::COMBAT, entity, result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue