VEGO-Engine  0.1
Loading...
Searching...
No Matches
StatEffectsComponent.h
1#pragma once
2#include "Component.h"
3#include "Constants.h"
4#include <cstdint>
5#include <array>
6#include <functional>
7
11struct StatEffect {
12 uint32_t duration;
13 std::function<void()> resetFunction;
14 uint32_t startTime;
15};
16
18class StatEffectsComponent : public Component{
19public:
20 StatEffectsComponent() {};
21 ~StatEffectsComponent() {};
22
23 void init() override;
24 void update(uint_fast16_t diffTime) override;
30 void addEffect(uint32_t duration, std::function<void()> resetFunction);
31
32private:
33 std::vector<StatEffect> effects = {};
34};
void addEffect(uint32_t duration, std::function< void()> resetFunction)
Add a stat effect to the entity.
Definition StatEffectsComponent.cpp:24
Struct to hold the duration, reset function and start time of a stat effect.
Definition StatEffectsComponent.h:11
std::function< void()> resetFunction
Function to reset the effect, will be called on expiry of duration.
Definition StatEffectsComponent.h:13
uint32_t duration
Duration of the effect in milliseconds.
Definition StatEffectsComponent.h:12