9#include "../../Components/Player.hpp"
18 if (mapEntities.empty()) {
23 for (
auto mapEntityId : mapEntities) {
27 if (mapData.isCompleted()) {
35 float scrollSpeed = mapData.getScrollSpeed();
36 if (scrollSpeed > 0.0f) {
41 float duration = mapData.getDuration();
42 if (duration > 0.0f && mapData.getElapsedTime() >= duration) {
43 LOG_INFO(
"Map '", mapData.getMapId(),
"' completed after ", mapData.getElapsedTime(),
45 mapData.markCompleted();
49 const std::string &nextMap = mapData.getNextMapId();
50 if (!nextMap.empty()) {
60 ComponentMask transformMask = (1ULL << getComponentType<Transform>());
64 float scrollOffset = -scrollSpeed * deltaTime;
66 for (
auto entityId : entities) {
74 transform.setPosition(pos.x + scrollOffset, pos.y);
79 return (1ULL << getComponentType<MapData>());
Component storing information about the current map/level.
void updateElapsedTime(float deltaTime)
Update the elapsed time.
void update(Registry ®istry, float deltaTime) override
Updates map state and handles scrolling.
void _applyScrolling(Registry ®istry, float scrollSpeed, float deltaTime)
Apply scrolling to entities (moves them left based on map speed).
ComponentMask getComponentMask() const override
Gets the component mask for this system.
Component identifying an entity as a player with game statistics.
Manages entities, their signatures and component type registrations.
std::vector< Address > getEntitiesWithMask(Signature requiredMask)
Get all entities matching a specific component mask.
T & getComponent(Address address)
Get a component from an entity.
bool hasComponent(Address address)
Check if an entity has a specific component.
Maximum number of distinct component types supported by the Registry.
std::uint64_t ComponentMask
Type alias for component bitmask.