Add hurt, die animation when taking damage

This commit is contained in:
2024-02-07 17:14:17 +01:00
parent d6466b8f55
commit 6c1d0dfdb2
16 changed files with 251 additions and 24 deletions

View File

@@ -156,6 +156,8 @@ typedef struct Animation {
i32 curFrame;
f32 elapsed;
bool playInFull;
} Animation;
extern ECS_COMPONENT_DECLARE(Animation);
@@ -183,6 +185,10 @@ extern ECS_COMPONENT_DECLARE(Easing);
/**********************************************************
* Event components
*********************************************************/
typedef struct DamageEvent {
f32 amount;
} DamageEvent;
typedef struct HarvestEvent {
ResourceType type;
i32 amount;
@@ -240,6 +246,10 @@ extern ECS_COMPONENT_DECLARE(Worker);
// Unit can:
// - Attack
typedef struct Unit {
f32 attackCooldown;
f32 attackElapsed;
f32 minDamage;
f32 maxDamage;
f32 maxSpeed;
f32 acceleration;
f32 deceleration;
@@ -273,6 +283,15 @@ extern ECS_COMPONENT_DECLARE(Harvestable);
extern ECS_TAG_DECLARE(Buildable);
extern ECS_TAG_DECLARE(Attackable);
/**********************************************************
* DelayDelete components
*********************************************************/
typedef struct DelayDelete {
f32 time;
f32 elapsed;
} DelayDelete;
extern ECS_COMPONENT_DECLARE(DelayDelete);
void initComponentIDs(ecs_world_t *ecs);
void igTagCheckbox(const char *label, ecs_world_t *ecs,