godot-cpp-utils/game_mode.hpp

28 lines
954 B
C++
Raw Normal View History

#ifndef UTILS_GAME_MODE_HPP
#define UTILS_GAME_MODE_HPP
#include <godot_cpp/classes/node.hpp>
#include <godot_cpp/classes/packed_scene.hpp>
namespace gd = godot;
namespace utils {
/*! Stores session-relevant data.
*
* Inheriting classes are intended to keep only data that is relevant for the duration of the current session/match. Use GameState instead if you want data to be saved between sessions.
* Will be destroyed when a level is loaded that does not match the same game mode class.
2024-05-30 13:42:53 +00:00
* The current active game mode can be gotten from the GameRoot3D singleton instance.
*/
class GameMode : public gd::Node {
GDCLASS(GameMode, gd::Node);
static void _bind_methods();
public:
void set_player_scene(gd::Ref<gd::PackedScene> scene);
gd::Ref<gd::PackedScene> get_player_scene() const;
private:
gd::Ref<gd::PackedScene> player_scene{}; //!< The scene to instantiate when spawning a player.
};
}
#endif // !UTILS_GAME_MODE_HPP