mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
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:
@@ -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
|
||||
|
||||
@@ -11,4 +11,9 @@ struct BaseClientCreature {
|
||||
|
||||
ModelID model;
|
||||
};
|
||||
|
||||
struct SoundTime {
|
||||
float next_call_time;
|
||||
};
|
||||
|
||||
} // namespace Cubed
|
||||
Reference in New Issue
Block a user