2024-03-13 15:08:37 +00:00
|
|
|
#include "game_mode.hpp"
|
|
|
|
#include <godot_cpp/classes/global_constants.hpp>
|
|
|
|
#include <godot_cpp/classes/packed_scene.hpp>
|
|
|
|
#include <godot_cpp/classes/scene_state.hpp>
|
|
|
|
#include "utils/godot_macros.h"
|
|
|
|
#include "game_state.hpp"
|
|
|
|
|
2024-05-28 14:28:36 +00:00
|
|
|
namespace utils {
|
2024-03-13 15:08:37 +00:00
|
|
|
void GameMode::_bind_methods() {
|
|
|
|
#define CLASSNAME GameMode
|
2024-05-28 14:28:36 +00:00
|
|
|
GDPROPERTY_HINTED(game_state, gd::Variant::OBJECT, gd::PROPERTY_HINT_RESOURCE_TYPE, "GameState");
|
|
|
|
GDPROPERTY_HINTED(player_scene, gd::Variant::OBJECT, gd::PROPERTY_HINT_RESOURCE_TYPE, "PackedScene");
|
2024-03-13 15:08:37 +00:00
|
|
|
}
|
|
|
|
|
2024-03-21 21:49:11 +00:00
|
|
|
void GameMode::_begin() {}
|
|
|
|
void GameMode::_end() {}
|
|
|
|
|
2024-05-28 14:28:36 +00:00
|
|
|
void GameMode::set_player_scene(gd::Ref<gd::PackedScene> scene) {
|
2024-03-13 15:08:37 +00:00
|
|
|
this->player_scene = scene;
|
|
|
|
}
|
|
|
|
|
2024-05-28 14:28:36 +00:00
|
|
|
gd::Ref<gd::PackedScene> GameMode::get_player_scene() const {
|
2024-03-13 15:08:37 +00:00
|
|
|
return this->player_scene;
|
|
|
|
}
|
|
|
|
|
2024-05-28 14:28:36 +00:00
|
|
|
void GameMode::set_game_state(gd::Ref<GameState> state) {
|
2024-03-13 15:08:37 +00:00
|
|
|
if(state.is_null() || !state.is_valid()) {
|
|
|
|
this->game_state.unref();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this->game_state = state;
|
|
|
|
}
|
|
|
|
|
2024-05-28 14:28:36 +00:00
|
|
|
gd::Ref<GameState> GameMode::get_game_state() {
|
2024-03-13 15:08:37 +00:00
|
|
|
return this->game_state;
|
|
|
|
}
|
|
|
|
}
|