major inventory system scripting job done, now onto creating blueprints, input action, and working on the GUI
This commit is contained in:
@ -11,17 +11,14 @@ AHYInteractableActor::AHYInteractableActor()
|
||||
|
||||
}
|
||||
|
||||
void AHYInteractableActor::Interact(APlayerController* Controller)
|
||||
{
|
||||
}
|
||||
|
||||
void AHYInteractableActor::Interact_Implementation(APlayerController* Controller)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FString AHYInteractableActor::GetInteractText() const
|
||||
{
|
||||
return FString();
|
||||
return FString::Printf(TEXT("s%: Press F to %s"), *Name, *Action);
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
|
26
hwanyoung2/Source/hwanyoung2/HYManualPickUp.cpp
Normal file
26
hwanyoung2/Source/hwanyoung2/HYManualPickUp.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "HYManualPickUp.h"
|
||||
#include "HYPlayerCharacController.h"
|
||||
|
||||
AHYManualPickUp::AHYManualPickUp()
|
||||
{
|
||||
PickUpRangeMesh = CreateDefaultSubobject<UStaticMeshComponent>("PickupMesh");
|
||||
RootComponent = Cast<USceneComponent>(PickUpRangeMesh);
|
||||
|
||||
ItemID = FName("No ID");
|
||||
|
||||
Super::Name = "Item";
|
||||
Super::Action = "pickup";
|
||||
}
|
||||
|
||||
void AHYManualPickUp::Interact_Implementation(APlayerController* Controller)
|
||||
{
|
||||
Super::Interact_Implementation(Controller);
|
||||
|
||||
AHYPlayerCharacController* IController = Cast<AHYPlayerCharacController>(Controller);
|
||||
if (IController->AddItemToInventoryByID(ItemID))
|
||||
Destroy();
|
||||
}
|
||||
|
27
hwanyoung2/Source/hwanyoung2/HYManualPickUp.h
Normal file
27
hwanyoung2/Source/hwanyoung2/HYManualPickUp.h
Normal file
@ -0,0 +1,27 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "HYInteractableActor.h"
|
||||
#include "HYManualPickUp.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class HWANYOUNG2_API AHYManualPickUp : public AHYInteractableActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
AHYManualPickUp();
|
||||
|
||||
void Interact_Implementation(APlayerController* Controller) override;
|
||||
|
||||
protected:
|
||||
UPROPERTY(EditAnywhere)
|
||||
UStaticMeshComponent* PickUpRangeMesh;
|
||||
|
||||
UPROPERTY(EditAnywhere,BlueprintReadWrite)
|
||||
FName ItemID;
|
||||
};
|
@ -12,11 +12,6 @@ AHYPlayerCharacController::AHYPlayerCharacController()
|
||||
InventoryWeightLimit = 500;
|
||||
}
|
||||
|
||||
void AHYPlayerCharacController::ReloadInventory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int32 AHYPlayerCharacController::GetInventoryWeight()
|
||||
{
|
||||
int32 TotalWeight = 0;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "Engine/DataTable.h"
|
||||
//#include "InventoryItem.generated.h"
|
||||
#include "InventoryItem.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -198,9 +198,6 @@ protected:
|
||||
// To add mapping context
|
||||
virtual void BeginPlay();
|
||||
|
||||
// Checks for the closest Interactable in sight and in range
|
||||
void CheckForInteractables();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user