develop #50

Merged
cromer merged 47 commits from develop into master 2022-09-02 00:37:34 -04:00
2 changed files with 11 additions and 1 deletions
Showing only changes of commit 5d611f790d - Show all commits

View File

@ -1,4 +1,5 @@
#include "gui/game_over/GameOverScreen.h" #include "gui/game_over/GameOverScreen.h"
#include "Event.h" #include "Event.h"
#include <PackedScene.hpp> #include <PackedScene.hpp>
@ -11,6 +12,7 @@ void alai::GameOverScreen::_register_methods()
{ {
godot::register_method("_on_restart_button_pressed", &GameOverScreen::_on_restart_button_pressed); godot::register_method("_on_restart_button_pressed", &GameOverScreen::_on_restart_button_pressed);
godot::register_method("_ready", &GameOverScreen::_ready); godot::register_method("_ready", &GameOverScreen::_ready);
godot::register_method("restart_game", &GameOverScreen::restart_game);
godot::register_method("connect_signal", &GameOverScreen::connect_signal); godot::register_method("connect_signal", &GameOverScreen::connect_signal);
godot::register_method("_on_player_died", &GameOverScreen::_on_player_died); godot::register_method("_on_player_died", &GameOverScreen::_on_player_died);
} }
@ -45,7 +47,7 @@ void alai::GameOverScreen::_on_restart_button_pressed()
{ {
level_node->add_child(level); level_node->add_child(level);
set_visible(false); set_visible(false);
call_deferred("connect_signal"); call_deferred("restart_game");
} }
else else
{ {
@ -79,6 +81,13 @@ void alai::GameOverScreen::_on_player_died()
} }
} }
void alai::GameOverScreen::restart_game()
{
auto event = get_node<alai::Event>("/root/Event");
event->emit_signal("game_started");
connect_signal();
}
void alai::GameOverScreen::connect_signal() void alai::GameOverScreen::connect_signal()
{ {
auto event = get_node<alai::Event>("/root/Event"); auto event = get_node<alai::Event>("/root/Event");

View File

@ -52,6 +52,7 @@ namespace alai
void _ready(); void _ready();
void _on_player_died(); void _on_player_died();
void _on_restart_button_pressed(); void _on_restart_button_pressed();
void restart_game();
void connect_signal(); void connect_signal();
}; };
} }