From a93199d8b8610002c72d293f5432e81be76ab73f Mon Sep 17 00:00:00 2001 From: Sara Date: Tue, 19 Mar 2024 13:22:55 +0100 Subject: [PATCH] feat: added character data --- src/character_data.cpp | 18 ++++++++++++++++++ src/character_data.hpp | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/character_data.cpp create mode 100644 src/character_data.hpp diff --git a/src/character_data.cpp b/src/character_data.cpp new file mode 100644 index 0000000..fd3caa9 --- /dev/null +++ b/src/character_data.cpp @@ -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 weapon) { + this->weapon = weapon; +} + +Ref CharacterData::get_weapon() const { + return this->weapon; +} +} diff --git a/src/character_data.hpp b/src/character_data.hpp new file mode 100644 index 0000000..09d8595 --- /dev/null +++ b/src/character_data.hpp @@ -0,0 +1,19 @@ +#ifndef CHARACTER_DATA_HPP +#define CHARACTER_DATA_HPP + +#include "weapon_data.hpp" +#include + +namespace godot { +class CharacterData : public Resource { + GDCLASS(CharacterData, Resource); + static void _bind_methods(); +public: + void set_weapon(Ref weapon); + Ref get_weapon() const; +private: + Ref weapon; +}; +} + +#endif // !CHARACTER_DATA_HPP