小弟打算用tmap做倉庫
UPROPERTY(EditDefaultsOnly, Category = Inventory)
TMap< FString,int32 >InventoryDatat;
FString,來記物品的ID,int32則是數量,就接下碰撞之後執行增加的運算
但 InventoryDatat.Add( 物品的ID ,數量) 但這個實在想不出來該如何寫
要如何把Actor的數值傳過來用
這是我的物品的設定
class AItemsBase : public AActor
{
GENERATED_BODY()
protected:
AItemsBase();
UPROPERTY(EditAnywhere)
UStaticMeshComponent* Mesh;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = CreatureData)
FString Items_ID;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = CreatureData)
int Quantity;
|