2022-08-12 21:50:48 -04:00
|
|
|
#include "gui/game_over/GameOverScreen.h"
|
2022-08-27 18:14:21 -04:00
|
|
|
#include <Resource.hpp>
|
|
|
|
#include <Ref.hpp>
|
2022-08-12 21:50:48 -04:00
|
|
|
#include <Node.hpp>
|
2022-08-26 13:51:19 -04:00
|
|
|
#include <SceneTree.hpp>
|
2022-08-27 18:14:21 -04:00
|
|
|
#include <PackedScene.hpp>
|
|
|
|
#include <Viewport.hpp>
|
2022-08-26 13:51:19 -04:00
|
|
|
|
2022-08-12 21:50:48 -04:00
|
|
|
using namespace godot;
|
|
|
|
|
|
|
|
void GameOverScreen::_register_methods()
|
2022-08-27 18:14:21 -04:00
|
|
|
{
|
|
|
|
register_method("_on_animation_finished", &GameOverScreen::_on_botonreiniciar_pressed);
|
2022-08-12 21:50:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
GameOverScreen::GameOverScreen()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
GameOverScreen::~GameOverScreen()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameOverScreen::_init()
|
|
|
|
{
|
2022-08-27 18:14:21 -04:00
|
|
|
_resource_loader = ResourceLoader::get_singleton();
|
2022-08-12 21:50:48 -04:00
|
|
|
|
|
|
|
}
|
2022-08-27 18:14:21 -04:00
|
|
|
|
|
|
|
void GameOverScreen::_on_botonreiniciar_pressed()
|
2022-08-12 21:50:48 -04:00
|
|
|
{
|
2022-08-27 18:14:21 -04:00
|
|
|
|
|
|
|
if (_resource_loader->exists("res://levels/Prototype.tscn")) //CAMBIAR A DINAMICO
|
|
|
|
{
|
|
|
|
Ref<PackedScene> level_scene = _resource_loader->load("res://levels/Prototype.tscn");
|
|
|
|
auto level = level_scene->instance();
|
|
|
|
auto level_node = get_tree()->get_root()->find_node("Level");
|
|
|
|
level_node->add_child(level);
|
|
|
|
}
|
2022-08-26 13:51:19 -04:00
|
|
|
}
|
2022-08-27 18:14:21 -04:00
|
|
|
|
|
|
|
|