He tornat a deixar el progres del fondo que fa tope en la ultima fase, no en el final del joc
This commit is contained in:
@@ -56,7 +56,7 @@ Game::Game(Player::Id player_id, int current_stage, bool demo)
|
||||
pause_manager_(std::make_unique<PauseManager>([this](bool is_paused) { onPauseStateChanged(is_paused); })),
|
||||
stage_manager_(std::make_unique<StageManager>()),
|
||||
balloon_manager_(std::make_unique<BalloonManager>(stage_manager_.get())),
|
||||
background_(std::make_unique<Background>(stage_manager_->getTotalPowerNeededToCompleteGame())),
|
||||
background_(std::make_unique<Background>(stage_manager_->getPowerNeededToReachStage(stage_manager_->getTotalStages() - 1))),
|
||||
fade_in_(std::make_unique<Fade>()),
|
||||
fade_out_(std::make_unique<Fade>()),
|
||||
tabe_(std::make_unique<Tabe>()),
|
||||
|
||||
@@ -243,6 +243,18 @@ auto StageManager::getTotalPowerNeededToCompleteGame() const -> int {
|
||||
return total_power_needed;
|
||||
}
|
||||
|
||||
auto StageManager::getPowerNeededToReachStage(size_t target_stage_index) const -> int {
|
||||
if (!validateStageIndex(target_stage_index)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int power_needed = 0;
|
||||
for (size_t i = 0; i < target_stage_index; ++i) {
|
||||
power_needed += stages_[i].getPowerToComplete();
|
||||
}
|
||||
return power_needed;
|
||||
}
|
||||
|
||||
// Implementación de la interfaz IStageInfo
|
||||
auto StageManager::canCollectPower() const -> bool {
|
||||
return power_collection_state_ == PowerCollectionState::ENABLED;
|
||||
|
||||
@@ -75,6 +75,7 @@ class StageManager : public IStageInfo {
|
||||
[[nodiscard]] auto getCurrentPower() const -> int { return current_power_; } // Obtiene el poder actual
|
||||
[[nodiscard]] auto getTotalPower() const -> int { return total_power_; } // Obtiene el poder total acumulado
|
||||
[[nodiscard]] auto getTotalPowerNeededToCompleteGame() const -> int; // Poder total necesario para completar el juego
|
||||
[[nodiscard]] auto getPowerNeededToReachStage(size_t target_stage_index) const -> int; // Poder necesario para llegar a la fase X
|
||||
[[nodiscard]] auto getTotalStages() const -> size_t { return stages_.size(); } // Obtiene el número total de fases
|
||||
|
||||
// --- Seguimiento de progreso ---
|
||||
|
||||
Reference in New Issue
Block a user