metro-rts/src/objective_flags.hpp

45 lines
1.3 KiB
C++

#ifndef OBJECTIVE_FLAGS_HPP
#define OBJECTIVE_FLAGS_HPP
#include "godot_cpp/templates/vector.hpp"
#include "godot_cpp/variant/array.hpp"
#include <cmath>
#include <godot_cpp/classes/node.hpp>
#include <godot_cpp/classes/resource.hpp>
#include <godot_cpp/templates/hash_set.hpp>
namespace gd = godot;
class ObjectiveData : public gd::Resource {
GDCLASS(ObjectiveData, gd::Resource);
static void _bind_methods();
public:
bool get_is_completed() const;
void set_target_count(int value);
int get_target_count() const;
void set_completed_count(int value);
int get_completed_count() const;
void set_sub_objectives_setting(gd::Array array);
gd::Array get_sub_objectives_setting() const;
private:
void check_is_done();
private:
int target_count{1};
int completed_count{0};
gd::Vector<gd::Ref<ObjectiveData>> sub_objectives{};
};
class ObjectiveFlags : public gd::Node {
GDCLASS(ObjectiveFlags, gd::Node);
static void _bind_methods();
public:
void register_objective(gd::Ref<ObjectiveData> objective_name);
gd::Ref<ObjectiveData> get_objective_by_name();
void set_currently_active_objectives(gd::Array array);
gd::Array get_currently_active_objectives() const;
private:
gd::HashSet<gd::Ref<ObjectiveData>> currently_active_objectives{};
};
#endif // !OBJECTIVE_FLAGS_HPP