godot-cpp-utils/level.cpp

25 lines
814 B
C++

#include "level.hpp"
#include <godot_cpp/core/class_db.hpp>
#include "utils/godot_macros.hpp"
#include <godot_cpp/classes/scene_state.hpp>
namespace utils {
void Level3D::_bind_methods() {
#define CLASSNAME Level3D
GDPROPERTY_HINTED(game_mode_prototype, gd::Variant::OBJECT, gd::PROPERTY_HINT_RESOURCE_TYPE, "PackedScene");
}
void Level3D::set_game_mode_prototype(gd::Ref<gd::PackedScene> prototype) {
if(prototype.is_null() || !prototype.is_valid())
this->game_mode_prototype = gd::Ref<gd::PackedScene>(nullptr);
else if(!gd::ClassDB::is_parent_class(prototype->get_state()->get_node_type(0), "GameMode"))
return;
else
this->game_mode_prototype = prototype;
}
gd::Ref<gd::PackedScene> Level3D::get_game_mode_prototype() const {
return this->game_mode_prototype;
}
}