30 lines
977 B
C++
30 lines
977 B
C++
#ifndef UTILS_GAME_MODE_HPP
|
|
#define UTILS_GAME_MODE_HPP
|
|
|
|
#include <godot_cpp/classes/packed_scene.hpp>
|
|
#include <godot_cpp/classes/resource.hpp>
|
|
|
|
namespace gd = godot;
|
|
|
|
namespace utils {
|
|
/*! Stores session-relevant data.
|
|
*
|
|
* Contains any data that is only needed 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.
|
|
*/
|
|
class GameMode : public gd::Resource {
|
|
GDCLASS(GameMode, gd::Resource);
|
|
static void _bind_methods();
|
|
public:
|
|
virtual void _begin(); //!< Called when the match begins.
|
|
virtual void _end(); //!< Called when the match is ending.
|
|
|
|
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
|