27 lines
680 B
C++
27 lines
680 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 = "pickup";
|
|
}
|
|
|
|
void AHYManualPickUp::Interact_Implementation(APlayerController* Controller)
|
|
{
|
|
Super::Interact_Implementation(Controller);
|
|
|
|
AHYPlayerCharacController* IController = Cast<AHYPlayerCharacController>(Controller);
|
|
if (IController->AddItemToInventoryByID(ItemID))
|
|
Destroy();
|
|
}
|
|
|