/
del00n
/
Space_Lab
Обзор
Документация
Войти
/
del00n
/
Space_Lab
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
LevelManager.h
48 строк
1 KB
del00n
upload files
22 янв 2026, 13:52
Верифицирован
22 янв 2026, 13:52
4016b42
Код
Авторство
О чём код?
#pragma once #include <algorithm> #include <filesystem> #include <fstream> #include <string> #include <vector> struct PlanetConfig { float x = 0.f; float y = 0.f; float mass = 2000.f; float radius = 30.f; }; struct LevelConfig { std::string name = "Level"; std::vector<PlanetConfig> planets; float offsetY = 0.f; int waypointCount = 5; float planetMass = 6000.f; }; class LevelManager { public: static constexpr int TOTAL_LEVELS = 10; LevelManager(); void loadLevel(int levelIdx); void saveLevel(int levelIdx, const LevelConfig& config); void createDefaultLevels(); const LevelConfig& getCurrentLevel() const { return currentLevel; } LevelConfig& getCurrentLevelMut() { return currentLevel; } int getCurrentLevelIdx() const { return currentLevelIdx; } void setCurrentLevel(int idx) { currentLevelIdx = idx; loadLevel(idx); } private: LevelConfig currentLevel; int currentLevelIdx = 0; std::string levelFilePath(int idx) const; };