28 lines
737 B
C++
28 lines
737 B
C++
// 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 = "pick up";
|
|
}
|
|
|
|
void AHYManualPickUp::Interact_Implementation(APlayerController* Controller)
|
|
{
|
|
Super::Interact_Implementation(Controller);
|
|
|
|
AHYPlayerCharacController* IController = Cast<AHYPlayerCharacController>(Controller);
|
|
if (IController->AddItemToInventoryByID(ItemID))
|
|
Destroy();
|
|
else UE_LOG(LogTemp, Warning, TEXT("Item not found."))
|
|
}
|
|
|