Compare commits

..

No commits in common. "e8cacbe1c7c553a0ae9573d8c1b7df9df19de7f9" and "05782979e99bb64a86e7984d553805a128103902" have entirely different histories.

101 changed files with 53 additions and 377 deletions

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.

View File

@ -1,44 +0,0 @@
// 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

@ -1,38 +0,0 @@
// 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

@ -1,18 +0,0 @@
// 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

@ -1,26 +0,0 @@
// 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,9 +43,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 InventoryWeightLimit;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Currency;
//interacts with the Interactable objects
UFUNCTION(BlueprintCallable, Category = "Utils")
void Interact();

View File

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

View File

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

View File

@ -12,7 +12,6 @@
#include "EnhancedInputSubsystems.h"
#include "HYInteractableActor.h"
#include "InventoryItem.h"
#include "HYAutomaticPickUp.h"
@ -98,29 +97,12 @@ 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)
{
Super::Tick(DeltaTime);
CheckForInteractables();
CollectAutoPickups();
}
//////////////////////////////////////////////////////////////////////////
@ -219,10 +201,6 @@ void Ahwanyoung2Character::Initialize()
// 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++)
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