Compare commits

..

3 Commits

Author SHA1 Message Date
Ji Yoon Rhee
e8cacbe1c7 the player character can automatically pick up souls 2024-08-22 23:24:14 +09:00
Ji Yoon Rhee
d91704b9a7 the NPC drops souls after being eliminated 2024-08-22 23:23:44 +09:00
Ji Yoon Rhee
83e44925bf added attribute sets for each types of attack, optimized some functions 2024-08-20 15:41:33 +09:00
101 changed files with 377 additions and 53 deletions

BIN
hwanyoung2/Content/GoodSky/Blueprint/BP_GoodSky.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
hwanyoung2/Content/GoodSky/Maps/Level_GoodSky_Showcase.umap (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
hwanyoung2/Content/Hwanyoung/UI/Images/botgim.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,44 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "HYAutomaticPickUp.h"
#include "HYPlayerCharacController.h"
// Sets default values
AHYAutomaticPickUp::AHYAutomaticPickUp()
{
// 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;
PickupMesh = CreateDefaultSubobject<UStaticMeshComponent>("PickupMesh");
RootComponent = Cast<USceneComponent>(PickupMesh);
ItemID = FName("No ID");
}
void AHYAutomaticPickUp::Collect_Implementation(APlayerController* Controller)
{
AHYPlayerCharacController* IController = Cast<AHYPlayerCharacController>(Controller);
if (IController->AddItemToInventoryByID(ItemID))
Destroy();
}
FName AHYAutomaticPickUp::GetItemID()
{
return ItemID;
}
// Called when the game starts or when spawned
void AHYAutomaticPickUp::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AHYAutomaticPickUp::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

View File

@ -0,0 +1,38 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "HYAutomaticPickUp.generated.h"
UCLASS()
class HWANYOUNG2_API AHYAutomaticPickUp : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AHYAutomaticPickUp();
UFUNCTION(BlueprintNativeEvent)
void Collect(APlayerController* Controller);
virtual void Collect_Implementation(APlayerController* Controller);
FName GetItemID();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UPROPERTY(EditAnywhere)
UStaticMeshComponent* PickupMesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FName ItemID;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};

View File

@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "HYMoneyAutoPickUp.h"
#include "HYPlayerCharacController.h"
AHYMoneyAutoPickUp::AHYMoneyAutoPickUp()
{
Super::ItemID = FName("Lost soul");
Value = 1;
}
void AHYMoneyAutoPickUp::Collect_Implementation(APlayerController* Controller)
{
AHYPlayerCharacController* IController = Cast<AHYPlayerCharacController>(Controller);
IController->Currency += Value;
Destroy();
}

View File

@ -0,0 +1,26 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "HYAutomaticPickUp.h"
#include "HYMoneyAutoPickUp.generated.h"
/**
*
*/
UCLASS()
class HWANYOUNG2_API AHYMoneyAutoPickUp : public AHYAutomaticPickUp
{
GENERATED_BODY()
public:
AHYMoneyAutoPickUp();
void Collect_Implementation(APlayerController* Controller) override;
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Value;
};

View File

@ -43,6 +43,9 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 InventoryWeightLimit; int32 InventoryWeightLimit;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Currency;
//interacts with the Interactable objects //interacts with the Interactable objects
UFUNCTION(BlueprintCallable, Category = "Utils") UFUNCTION(BlueprintCallable, Category = "Utils")
void Interact(); void Interact();

View File

@ -7,5 +7,6 @@ FInventoryItem::FInventoryItem()
{ {
this->ItemName = FText::FromString("No Name"); this->ItemName = FText::FromString("No Name");
this->ItemWeight = 1; this->ItemWeight = 1;
this->ItemValue = 1;
this->ItemDescription = FText::FromString("No Description"); this->ItemDescription = FText::FromString("No Description");
} }

View File

@ -37,6 +37,10 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 ItemWeight; int32 ItemWeight;
//value of the item
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 ItemValue;
//is the item only available through drops? //is the item only available through drops?
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool OnlyDropped; bool OnlyDropped;

View File

@ -12,6 +12,7 @@
#include "EnhancedInputSubsystems.h" #include "EnhancedInputSubsystems.h"
#include "HYInteractableActor.h" #include "HYInteractableActor.h"
#include "InventoryItem.h" #include "InventoryItem.h"
#include "HYAutomaticPickUp.h"
@ -97,12 +98,29 @@ void Ahwanyoung2Character::CheckForInteractables()
} }
void Ahwanyoung2Character::CollectAutoPickups()
{
// Stores all the overlapping actors in an array
TArray<AActor*> CollectedActors;
CollectionSphere->GetOverlappingActors(CollectedActors);
AHYPlayerCharacController* IController = Cast<AHYPlayerCharacController>(GetController());
for (int32 indCollect = 0; indCollect < CollectedActors.Num(); ++indCollect) {
AHYAutomaticPickUp* const Pickup = Cast<AHYAutomaticPickUp>(CollectedActors[indCollect]);
if (Pickup && !Pickup->IsPendingKill()) {
Pickup->Collect(IController);
}
}
}
void Ahwanyoung2Character::Tick(float DeltaTime) void Ahwanyoung2Character::Tick(float DeltaTime)
{ {
Super::Tick(DeltaTime); Super::Tick(DeltaTime);
CheckForInteractables(); CheckForInteractables();
CollectAutoPickups();
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -201,6 +219,10 @@ void Ahwanyoung2Character::Initialize()
// Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character) // Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character)
// are set in the derived blueprint asset named ThirdPersonCharacter (to avoid direct content references in C++) // are set in the derived blueprint asset named ThirdPersonCharacter (to avoid direct content references in C++)
CollectionSphere = CreateDefaultSubobject<USphereComponent>(TEXT("CollectionSphere"));
CollectionSphere->SetupAttachment(RootComponent);
CollectionSphere->SetSphereRadius(200.f);
} }

Some files were not shown because too many files have changed in this diff Show More