-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgameplay_attribute.h
80 lines (59 loc) · 2.12 KB
/
gameplay_attribute.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
#include "gameplay_node.h"
#include <core/array.h>
#include <core/hash_map.h>
#include <core/io/resource_loader.h>
#include <core/pool_vector.h>
#include <core/resource.h>
#include <core/variant.h>
#include <core/vector.h>
class GameplayEffect;
class GameplayAbilitySystem;
class GAMEPLAY_ABILITIES_API GameplayAttributeData : public GameplayResource {
GDCLASS(GameplayAttributeData, GameplayResource);
OBJ_CATEGORY("GameplayAbilities");
public:
virtual ~GameplayAttributeData() = default;
void reset_to_base();
void set_base_value(double value);
double get_base_value() const;
void set_current_value(double value);
double get_current_value() const;
private:
double base_value = 0;
double current_value = 0;
static void _bind_methods();
};
class GAMEPLAY_ABILITIES_API GameplayAttribute : public GameplayResource {
GDCLASS(GameplayAttribute, GameplayResource);
OBJ_CATEGORY("GameplayAbilities");
public:
virtual ~GameplayAttribute() = default;
void set_attribute_name(const StringName &value);
StringName get_attribute_name() const;
void set_attribute_data(const Ref<GameplayAttributeData> &value);
Ref<GameplayAttributeData> get_attribute_data() const;
private:
StringName attribute_name;
Ref<GameplayAttributeData> attribute_data;
static void _bind_methods();
};
class GAMEPLAY_ABILITIES_API GameplayAttributeSet : public GameplayResource {
GDCLASS(GameplayAttributeSet, GameplayResource);
OBJ_CATEGORY("GameplayAbilities");
public:
virtual ~GameplayAttributeSet() = default;
bool has_attribute(const StringName &name) const;
void add_attribute(const StringName &name, double base_value);
void update_attribute(const StringName &name, double base_value, bool reset_current_value = true);
void remove_attribute(const StringName &name);
Array get_attributes() const;
Ref<GameplayAttribute> get_attribute(const StringName &name) const;
Ref<GameplayAttributeData> get_attribute_data(const StringName &name) const;
void set_attribute_set_name(const StringName &value);
StringName get_attribute_set_name() const;
private:
StringName attribute_set_name;
Dictionary attributes;
static void _bind_methods();
};