class Level {
public:
class EntityEvents
{
private:
std::vector<std::pair<size_t, std::vector<size_t>>> _spawns;
unsigned char _entity;
std::vector<std::pair<size_t, std::vector<size_t>>>::iterator _it;
bool _init = true;
public:
EntityEvents(unsigned char entity);
~EntityEvents();
std::vector<size_t> getSpawns(size_t currentTimecode);
void addSpawn(size_t timecode, size_t pos);
unsigned char getEntity() const;
void sort();
bool isFinished() const;
void setInit(bool init);
};
class StrobeEvent
{
private:
std::vector<std::tuple<size_t, unsigned char, bool>> _strobe;
std::vector<std::tuple<size_t, unsigned char, bool>>::iterator _it;
bool _init = true;
public:
StrobeEvent();
~StrobeEvent();
std::vector<std::tuple<size_t, unsigned char, bool>> getEvents(size_t currentTimecode);
void addColor(size_t timecode, unsigned char color, size_t duration);
void sort();
bool isFinished() const;
void setInit(bool init);
};
Level(const std::string &path);
~Level();
std::vector<EntityEvents> &getEvents();
StrobeEvent &getStrobes();
unsigned char getSong() const;
bool isEnded() const;
private:
void parsSong(const std::string &line, const std::string &path, size_t line_nb);
void parsEvents(const std::string &line, const std::string &path, size_t line_nb);
std::vector<EntityEvents> _events;
StrobeEvent _strobes;
unsigned char _song = 0;
char _parserEntity = -1;
};
Level(const std::string &path);
The Getter function are used to get the differents events of the level like spawn entities or spawn strobes
std::vector<EntityEvents> &getEvents();
StrobeEvent &getStrobes();
unsigned char getSong() const;