EntityEvents
This class is used to contain all events for an entity type in the level
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);
};
Constructor
Parameters:
An index that represent the entity type
EntityEvents(unsigned char entity);
getSpawns
This method return a vector of size_t that represent the list of point on y axe where entity should spawn at the timestamp given in parameter
std::vector<size_t> getSpawns(size_t currentTimecode);
addSpawn
This method append an entity in the _spawns vector at the given timecode and on the given position
void addSpawn(size_t timecode, size_t pos);
getEntity
This method return the entity type of the class
unsigned char getEntity() const;
sort
This method is called when the file is fully pared. It sort the _spawns vector by timecode order
void sort();
isFinished
This method check if it remain entity in the _spawns vector
bool isFinished() const;
Last updated