RealtimeStyleTransferRuntime/Source/LyraGame/Inventory/InventoryFragment_SetStats.cpp

22 lines
533 B
C++
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "InventoryFragment_SetStats.h"
#include "Inventory/LyraInventoryItemInstance.h"
void UInventoryFragment_SetStats::OnInstanceCreated(ULyraInventoryItemInstance* Instance) const
{
for (const auto& KVP : InitialItemStats)
{
Instance->AddStatTagStack(KVP.Key, KVP.Value);
}
}
int32 UInventoryFragment_SetStats::GetItemStatByTag(FGameplayTag Tag) const
{
if (const int32* StatPtr = InitialItemStats.Find(Tag))
{
return *StatPtr;
}
return 0;
}