ProjectTextRPG/TextRPG/Source/Core/Item/Item.h

40 lines
950 B
C++

#pragma once
#include "Core/Object/GameObject.h"
struct ItemStatData
{
ItemStatData() = default;
ItemStatData(const std::string& ItemName, const int InPrice) : Name(ItemName), Price(InPrice){}
ItemStatData(const ItemStatData& other) : Name(other.Name), Price(other.Price) {}
ItemStatData(ItemStatData&& other) noexcept : Name(std::move(other.Name)), Price(other.Price) {}
std::string Name;
int Price;
};
class Item : public GameObject
{
public:
Item();
Item(const ItemStatData& NewData);
Item& operator=(const Item& Other);
~Item() override;
static bool ComparePriceDesc(Item& A, Item& B)
{
return A.GetItemPrice() > B.GetItemPrice();
}
void Initalize() override;
void Release() override;
bool Equals(const std::string& FindName){ return this->ItemData.Name == FindName; }
std::string GetItemName() const { return ItemData.Name; }
int GetItemPrice() const { return ItemData.Price; }
private:
ItemStatData ItemData;
};