idk if i'm doing this correctly bro please help me lord
This commit is contained in:
@ -11,6 +11,14 @@ AHYInteractableActor::AHYInteractableActor()
|
||||
|
||||
}
|
||||
|
||||
void AHYInteractableActor::Interact(APlayerController* Controller)
|
||||
{
|
||||
}
|
||||
|
||||
void AHYInteractableActor::Interact_Implementation(APlayerController* Controller)
|
||||
{
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AHYInteractableActor::BeginPlay()
|
||||
{
|
||||
|
@ -3,6 +3,24 @@
|
||||
|
||||
#include "HYPlayerCharacController.h"
|
||||
|
||||
AHYPlayerCharacController::AHYPlayerCharacController()
|
||||
{
|
||||
}
|
||||
|
||||
void AHYPlayerCharacController::ReloadInventory()
|
||||
{
|
||||
}
|
||||
|
||||
int32 AHYPlayerCharacController::GetInventoryWeight()
|
||||
{
|
||||
return int32();
|
||||
}
|
||||
|
||||
bool AHYPlayerCharacController::AddItemToInventoryByID(FName ID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void AHYPlayerCharacController::OnPossess(APawn* InPawn)
|
||||
{
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Interactable.h"
|
||||
#include "HYInteractableActor.h"
|
||||
#include "InventoryItem.h"
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
@ -16,6 +17,39 @@ class HWANYOUNG2_API AHYPlayerCharacController : public APlayerController
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
#pragma region inventory
|
||||
AHYPlayerCharacController();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void ReloadInventory();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Utils")
|
||||
int32 GetInventoryWeight();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Utils")
|
||||
bool AddItemToInventoryByID(FName ID);
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||
class AHYInteractableActor* CurrentInteractable;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||
TArray<FInventoryItem> Inventory;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 InventorySlotLimit;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 InventoryWeightLimit;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
void Interact();
|
||||
|
||||
virtual void SetupInputComponent() override;
|
||||
|
||||
virtual void OnPossess(APawn* InPawn) override;
|
||||
};
|
||||
|
6
hwanyoung2/Source/hwanyoung2/InventoryItem.cpp
Normal file
6
hwanyoung2/Source/hwanyoung2/InventoryItem.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "InventoryItem.h"
|
||||
|
||||
|
19
hwanyoung2/Source/hwanyoung2/InventoryItem.h
Normal file
19
hwanyoung2/Source/hwanyoung2/InventoryItem.h
Normal file
@ -0,0 +1,19 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "Engine/DataTable.h"
|
||||
//#include "InventoryItem.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FInventoryItem : public FTableRowBase
|
||||
{
|
||||
//GENERATED_USTRUCT_BODY();
|
||||
public:
|
||||
FInventoryItem();
|
||||
};
|
@ -186,7 +186,7 @@ void Ahwanyoung2Character::CheckForInteractables()
|
||||
ECC_Visibility, QueryParams)) {
|
||||
|
||||
//Cast the actor to AInteractable
|
||||
AInteractable* Interactable = Cast<AInteractable>(HitResult.GetActor());
|
||||
AHYInteractableActor* Interactable = Cast<AHYInteractableActor>(HitResult.GetActor());
|
||||
|
||||
if (Interactable) {
|
||||
IController->CurrentInteractable = Interactable;
|
||||
|
Reference in New Issue
Block a user