feat(audio): add ambient pig sounds

Add pig call audio with randomized timing, triggered by proximity to the player as 3D positional sound.
This commit is contained in:
2026-08-07 08:41:56 +08:00
parent 9745ccc7d6
commit 6e7bef8626
4 changed files with 39 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include "Cubed/gameplay/ecs/entity.hpp"
#include "Cubed/gameplay/gait.hpp"
#include "Cubed/tools/cubed_random.hpp"
#include "glm/ext/vector_float3.hpp"
#include "world/entity.pb.h"
@@ -26,6 +27,8 @@ public:
const entt::registry& get_registry() const;
void player_sound(float dt);
private:
struct EntityCreateElement {
EntityID id;
@@ -52,7 +55,7 @@ private:
EntityMap m_entities;
std::unordered_map<std::string_view, CreateFunc> m_factories;
tbb::concurrent_queue<TaskPair> m_tasks;
Random m_random;
void handle_task(float dt);
void handle_entity_destory(EntityID id);
// not thread safe

View File

@@ -11,4 +11,9 @@ struct BaseClientCreature {
ModelID model;
};
struct SoundTime {
float next_call_time;
};
} // namespace Cubed