godot-cpp-utils/game_mode.cpp

38 lines
999 B
C++

#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"
namespace godot {
void GameMode::_bind_methods() {
#define CLASSNAME GameMode
GDPROPERTY_HINTED(game_state, Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, "GameState");
GDPROPERTY_HINTED(player_scene, Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, "PackedScene");
}
void GameMode::_begin() {}
void GameMode::_end() {}
void GameMode::set_player_scene(Ref<PackedScene> scene) {
this->player_scene = scene;
}
Ref<PackedScene> GameMode::get_player_scene() const {
return this->player_scene;
}
void GameMode::set_game_state(Ref<GameState> state) {
if(state.is_null() || !state.is_valid()) {
this->game_state.unref();
return;
}
this->game_state = state;
}
Ref<GameState> GameMode::get_game_state() {
return this->game_state;
}
}