50 MapData(
const std::string &mapId,
float scrollSpeed,
const std::string &backgroundSprite,
51 const std::string &spawnScript)
76 MapData(
const std::string &mapId,
const std::string &name,
float scrollSpeed,
77 const std::string &backgroundSprite,
const std::string &spawnScript,
float duration,
78 const std::string &nextMapId,
const std::string ¶llaxBackground =
"",
79 float parallaxSpeedFactor = 0.5f)
Base interface for all ECS components.
Component storing information about the current map/level.
float _parallaxSpeedFactor
Speed factor for parallax layer (0.5 = half speed)
float _scrollSpeed
Horizontal scroll speed (px/s)
std::string _backgroundSprite
Background asset path.
const std::string & getNextMapId() const
Get the next map ID.
std::string _name
Display name.
void setScrollSpeed(float speed)
Set the scroll speed.
float getParallaxSpeedFactor() const
Get the parallax speed factor.
void setBackgroundSprite(const std::string &sprite)
Set the background sprite.
const std::string & getMapId() const
Get the map unique identifier.
bool isCompleted() const
Check if the map is completed.
ComponentType getType() const override
Get the component type ID.
MapData(const std::string &mapId, const std::string &name, float scrollSpeed, const std::string &backgroundSprite, const std::string &spawnScript, float duration, const std::string &nextMapId, const std::string ¶llaxBackground="", float parallaxSpeedFactor=0.5f)
Full constructor with all parameters.
~MapData() override=default
void reset()
Reset the map state (elapsed time and completion).
const std::string & getBackgroundSprite() const
Get the background sprite path.
float _duration
Map duration in seconds (0 = infinite)
std::string _mapId
Unique map identifier.
void setSpawnScript(const std::string &script)
Set the spawn script.
std::string _nextMapId
Next map to load after completion.
void setParallaxSpeedFactor(float factor)
Set the parallax speed factor.
float _elapsedTime
Time spent on this map.
void setNextMapId(const std::string &nextMapId)
Set the next map ID.
std::string _parallaxBackgroundSprite
Parallax layer asset path (rendered on top, scrolls slower)
bool _isCompleted
Completion flag.
float getScrollSpeed() const
Get the scroll speed.
void setMapId(const std::string &mapId)
Set the map ID.
MapData()
Default constructor. Initializes with empty map data.
void setParallaxBackgroundSprite(const std::string &sprite)
Set the parallax background sprite.
float getElapsedTime() const
Get the elapsed time on this map.
void setDuration(float duration)
Set the map duration.
void setName(const std::string &name)
Set the map name.
const std::string & getSpawnScript() const
Get the spawn script path.
float getDuration() const
Get the map duration.
MapData(const std::string &mapId, float scrollSpeed, const std::string &backgroundSprite, const std::string &spawnScript)
Constructor with basic parameters.
std::string _spawnScript
Lua script for spawn logic.
const std::string & getParallaxBackgroundSprite() const
Get the parallax background sprite path.
const std::string & getName() const
Get the map display name.
void updateElapsedTime(float deltaTime)
Update the elapsed time.
void markCompleted()
Mark the map as completed.
Maximum number of distinct component types supported by the Registry.
std::size_t ComponentType
Type alias for component identification.