2024-05-29 21:05:39 +00:00
|
|
|
#ifndef UTILS_GAME_MODE_HPP
|
|
|
|
#define UTILS_GAME_MODE_HPP
|
2024-03-13 15:08:37 +00:00
|
|
|
|
|
|
|
#include <godot_cpp/classes/packed_scene.hpp>
|
|
|
|
#include <godot_cpp/classes/resource.hpp>
|
|
|
|
|
2024-05-28 14:28:36 +00:00
|
|
|
namespace gd = godot;
|
|
|
|
|
|
|
|
namespace utils {
|
2024-05-29 15:36:17 +00:00
|
|
|
/*! 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.
|
|
|
|
*/
|
2024-05-28 14:28:36 +00:00
|
|
|
class GameMode : public gd::Resource {
|
|
|
|
GDCLASS(GameMode, gd::Resource);
|
2024-03-13 15:08:37 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
public:
|
2024-05-29 15:36:17 +00:00
|
|
|
virtual void _begin(); //!< Called when the match begins.
|
|
|
|
virtual void _end(); //!< Called when the match is ending.
|
2024-03-21 21:49:11 +00:00
|
|
|
|
2024-05-28 14:28:36 +00:00
|
|
|
void set_player_scene(gd::Ref<gd::PackedScene> scene);
|
|
|
|
gd::Ref<gd::PackedScene> get_player_scene() const;
|
2024-03-13 15:08:37 +00:00
|
|
|
private:
|
2024-05-29 15:36:17 +00:00
|
|
|
gd::Ref<gd::PackedScene> player_scene{}; //!< The scene to instantiate when spawning a player.
|
2024-03-13 15:08:37 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-05-29 21:05:39 +00:00
|
|
|
#endif // !UTILS_GAME_MODE_HPP
|