BossFightUI is not managed by the level manager since it is kind of a new level, just with a different mini game.

This commit is contained in:
Zed A. Shaw 2025-03-03 11:15:49 -05:00
parent a3f6ba3c03
commit ca18422930
12 changed files with 49 additions and 67 deletions

View file

@ -20,7 +20,6 @@ namespace gui {
$map_ui($level),
$combat_ui($level),
$status_ui($level),
$boss_fight_ui($level, "RAT_KING"),
$font{FONT_FILE_NAME}
{
}
@ -50,7 +49,9 @@ namespace gui {
$status_ui.init();
$status_ui.log("Welcome to the game!");
$status_ui.update();
$boss_fight_ui.init();
$boss_fight_ui = $levels.create_bossfight($level.world);
$boss_fight_ui->init();
$renderer.init_terminal();
$map_ui.create_render();
@ -249,9 +250,9 @@ namespace gui {
if(mouse->button == sf::Mouse::Button::Left) {
sf::Vector2f pos = $window.mapPixelToCoords(mouse->position);
if(in_state(State::NEXT_LEVEL)) {
$boss_fight_ui.mouse(pos.x, pos.y);
$boss_fight_ui->mouse(pos.x, pos.y);
if($boss_fight_ui.boss_dead()) {
if($boss_fight_ui->boss_dead()) {
event(Event::STAIRS_DOWN);
}
} else {
@ -315,7 +316,7 @@ namespace gui {
void FSM::draw_gui() {
if(in_state(State::NEXT_LEVEL)) {
$boss_fight_ui.render($window);
$boss_fight_ui->render($window);
} else {
$main_ui.render();
$status_ui.render($window);
@ -330,7 +331,7 @@ namespace gui {
$renderer.draw($map_ui);
} else if(in_state(State::NEXT_LEVEL)) {
$window.clear();
$boss_fight_ui.render($window);
$boss_fight_ui->render($window);
} else {
draw_gui();
}
@ -422,7 +423,8 @@ namespace gui {
$combat_ui.update_level($level);
$map_ui.update_level($level);
$main_ui.update_level($level);
$boss_fight_ui.update_level($level);
$boss_fight_ui = $levels.create_bossfight($level.world);
$boss_fight_ui->init();
run_systems();
}