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
17class StatEffectsComponent : public Component{
18public:
19 StatEffectsComponent() {};
20 ~StatEffectsComponent() {};
21
22 void init() override;
23 void update(uint_fast16_t diffTime) override;
29 void addEffect(uint32_t duration, std::function<void()> resetFunction);
30
31private:
32 std::vector<StatEffect> effects = {};
33};
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