dirt-racer/src/rally_rush_game_mode.cpp
2024-05-22 09:32:53 +02:00

32 lines
974 B
C++

#include "rally_rush_game_mode.hpp"
#include "godot_cpp/classes/resource_loader.hpp"
#include "utils/game_root.hpp"
#include "utils/godot_macros.h"
namespace godot {
void RallyRushGameMode::_bind_methods() {
#define CLASSNAME RallyRushGameMode
GDSIGNAL("key_found", PropertyInfo(Variant::INT, "total_found"));
GDSIGNAL("all_keys_found");
}
int RallyRushGameMode::get_num_found_keys() {
return this->num_keys_found;
}
void RallyRushGameMode::notify_key_found() {
++this->num_keys_found;
this->emit_signal("key_found", num_keys_found);
if(num_keys_found == 3)
this->emit_signal("all_keys_found");
}
void RallyRushGameMode::notify_player_death() {
GameRoot3D::get_singleton()->replace_levels(ResourceLoader::get_singleton()->load("res://game_end_screen.tscn"));
}
void RallyRushGameMode::notify_player_escaped() {
GameRoot3D::get_singleton()->replace_levels(ResourceLoader::get_singleton()->load("res://game_end_screen.tscn"));
}
}