Attach E skill Effect on Haesol's Foot. Create ShopAOE/NPCActor cpp class
This commit is contained in:
parent
ab9fd60b77
commit
051c65fde0
BIN
hwanyoung2/Content/Hwanyoung/Character/PlayerCharacter/BP_PlayerCharacterBase.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/Character/PlayerCharacter/BP_PlayerCharacterBase.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/Character/PlayerCharacter/Playables/Haesol/BP_Haesol.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/Character/PlayerCharacter/Playables/Haesol/BP_Haesol.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/UI/Shop_HUD/BP_ShopHUDWidget.uasset
(Stored with Git LFS)
Normal file
BIN
hwanyoung2/Content/Hwanyoung/UI/Shop_HUD/BP_ShopHUDWidget.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/UI/Shop_HUD/BP_ShopItemSlot.uasset
(Stored with Git LFS)
Normal file
BIN
hwanyoung2/Content/Hwanyoung/UI/Shop_HUD/BP_ShopItemSlot.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hwanyoung2/Content/IdaFaber/Meshes/Boy/SKEL_UE5_M.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/IdaFaber/Meshes/Boy/SKEL_UE5_M.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/KTP_Effect/Particles/Bottom/Bottom01-04.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/KTP_Effect/Particles/Bottom/Bottom01-04.uasset
(Stored with Git LFS)
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -31,7 +31,7 @@ public:
|
||||
FText Action;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Pickup")
|
||||
FText GetInteractText() const;
|
||||
virtual FText GetInteractText() const;
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
|
88
hwanyoung2/Source/hwanyoung2/HYShopAOE.cpp
Normal file
88
hwanyoung2/Source/hwanyoung2/HYShopAOE.cpp
Normal file
@ -0,0 +1,88 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#include "HYShopAOE.h"
|
||||
#include "HYGameStateBase.h"
|
||||
#include "Engine/DataTable.h"
|
||||
|
||||
// Sets default values
|
||||
AHYShopAOE::AHYShopAOE()
|
||||
{
|
||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AHYShopAOE::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AHYShopAOE::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
}
|
||||
|
||||
bool AHYShopAOE::RandomizeTradableItemSets(int CurrentHonbaekAmount)
|
||||
{
|
||||
AHYGameStateBase* GameState = Cast<AHYGameStateBase>(GetWorld()->GetGameState());
|
||||
|
||||
if(GameState == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
UDataTable* ItemDataTable = GameState->GetItemDatabase();
|
||||
|
||||
if (ItemDataTable == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TArray<FInventoryItem*> ItemData;
|
||||
ItemDataTable->GetAllRows<FInventoryItem>("", ItemData);
|
||||
|
||||
if (ItemData.Num() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TArray<FInventoryItem*> FilteredItemData = ItemData.FilterByPredicate([CurrentHonbaekAmount](const FInventoryItem* ItemDataRow)
|
||||
{
|
||||
return ItemDataRow->ItemValue <= CurrentHonbaekAmount;
|
||||
});
|
||||
|
||||
int maxLoopNum = FMath::Min(5, FilteredItemData.Num());
|
||||
|
||||
for (int i = 0; i < maxLoopNum; ++i)
|
||||
{
|
||||
int RandomIdx = FMath::RandRange(0, FilteredItemData.Num() - 1);
|
||||
|
||||
FinalItemSets.Add(*FilteredItemData[RandomIdx]);
|
||||
FilteredItemData.RemoveAt(RandomIdx);
|
||||
}
|
||||
|
||||
if (FinalItemSets.Num() == maxLoopNum)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void AHYShopAOE::GetTradableItemSets(TMap<FInventoryItem, int>& Item)
|
||||
{
|
||||
TArray<FInventoryItem> TempItems = FinalItemSets.Array();
|
||||
|
||||
for (FInventoryItem TempItem : TempItems)
|
||||
{
|
||||
int Amount = FMath::RandRange(0, 100);
|
||||
|
||||
Item.Add({ TempItem, Amount });
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
39
hwanyoung2/Source/hwanyoung2/HYShopAOE.h
Normal file
39
hwanyoung2/Source/hwanyoung2/HYShopAOE.h
Normal file
@ -0,0 +1,39 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "InventoryItem.h"
|
||||
#include "HYShopAOE.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class HWANYOUNG2_API AHYShopAOE : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AHYShopAOE();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
// Called When Begin Overlapped Event.
|
||||
UFUNCTION(BlueprintCallable)
|
||||
virtual bool RandomizeTradableItemSets(int CurrentHonbaekAmount);
|
||||
|
||||
// @param Item is NPC Actor's Array.
|
||||
// Make random amount of the tradable items set.
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void GetTradableItemSets(TMap<FInventoryItem, int>& Item);
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Data")
|
||||
TSet<FInventoryItem> FinalItemSets;
|
||||
};
|
8
hwanyoung2/Source/hwanyoung2/HYShopNPCActor.cpp
Normal file
8
hwanyoung2/Source/hwanyoung2/HYShopNPCActor.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#include "HYShopNPCActor.h"
|
||||
|
||||
void AHYShopNPCActor::Interact_Implementation(APlayerController* Controller)
|
||||
{
|
||||
|
||||
}
|
24
hwanyoung2/Source/hwanyoung2/HYShopNPCActor.h
Normal file
24
hwanyoung2/Source/hwanyoung2/HYShopNPCActor.h
Normal file
@ -0,0 +1,24 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "HYInteractableActor.h"
|
||||
#include "InventoryItem.h"
|
||||
#include "HYShopNPCActor.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class HWANYOUNG2_API AHYShopNPCActor : public AHYInteractableActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
virtual void Interact_Implementation(APlayerController* Controller);
|
||||
|
||||
public:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TMap<FInventoryItem, int> TradableItems;
|
||||
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user