feat: added character data
This commit is contained in:
parent
5da196b226
commit
a93199d8b8
18
src/character_data.cpp
Normal file
18
src/character_data.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "character_data.hpp"
|
||||
#include "utils/godot_macros.h"
|
||||
#include "weapon_data.hpp"
|
||||
|
||||
namespace godot {
|
||||
void CharacterData::_bind_methods() {
|
||||
#define CLASSNAME CharacterData
|
||||
GDPROPERTY_HINTED(weapon, Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, "WeaponData");
|
||||
}
|
||||
|
||||
void CharacterData::set_weapon(Ref<WeaponData> weapon) {
|
||||
this->weapon = weapon;
|
||||
}
|
||||
|
||||
Ref<WeaponData> CharacterData::get_weapon() const {
|
||||
return this->weapon;
|
||||
}
|
||||
}
|
19
src/character_data.hpp
Normal file
19
src/character_data.hpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef CHARACTER_DATA_HPP
|
||||
#define CHARACTER_DATA_HPP
|
||||
|
||||
#include "weapon_data.hpp"
|
||||
#include <godot_cpp/classes/resource.hpp>
|
||||
|
||||
namespace godot {
|
||||
class CharacterData : public Resource {
|
||||
GDCLASS(CharacterData, Resource);
|
||||
static void _bind_methods();
|
||||
public:
|
||||
void set_weapon(Ref<WeaponData> weapon);
|
||||
Ref<WeaponData> get_weapon() const;
|
||||
private:
|
||||
Ref<WeaponData> weapon;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // !CHARACTER_DATA_HPP
|
Loading…
Reference in a new issue