Add wood punch sound

This commit is contained in:
2024-01-06 20:22:33 +01:00
parent 114a464c95
commit adf8545b6e
6 changed files with 81 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
#include "systems.h"
#include "../game_state.h"
#include "../sounds.h"
i32 harvestEvent(ecs_entity_t entity, HarvestEvent event) {
BZ_ASSERT(ecs_has_id(ECS, entity, Harvestable));
@@ -10,13 +11,15 @@ i32 harvestEvent(ecs_entity_t entity, HarvestEvent event) {
.compID = ecs_id(Rotation),
.memberOffset = 0,
.easingFunc = BZ_EASE_OUT_ELASTIC,
.duration = 0.4f,
.duration = 0.6f,
// 45 * (1.0f + (-1.0f) * x)
.target = 45,
.easeTarget = -1.0f,
.easeStart = 1.0f
});
SoundState *sounds = ecs_singleton_get_mut(ECS, SoundState);
soundsPlay(sounds, SOUND_WOOD_PUNCH);
Resource *res = ecs_get_mut(ECS, entity, Resource);
event.amount = BZ_MIN(event.amount, res->amount);