mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 09:03:42 +00:00
- reimplemented/unhardcoded stateffects - reimplemented/unhardcoded pickupables - implemented datacomponent - some minor cleanup
26 lines
574 B
C++
26 lines
574 B
C++
#pragma once
|
|
#include "Component.h"
|
|
#include "Constants.h"
|
|
#include <cstdint>
|
|
#include <array>
|
|
#include <functional>
|
|
|
|
// This acts as a manager for the lifetime of a stateffect
|
|
struct StatEffect {
|
|
uint32_t duration;
|
|
std::function<void()> resetFunction;
|
|
uint32_t startTime;
|
|
};
|
|
|
|
class StatEffectsComponent : public Component{
|
|
public:
|
|
StatEffectsComponent() {};
|
|
~StatEffectsComponent() {};
|
|
|
|
void init() override;
|
|
void update() override;
|
|
void addEffect(uint32_t duration, std::function<void()> resetFunction);
|
|
|
|
private:
|
|
std::vector<StatEffect> effects = {};
|
|
}; |