Replaced Interactable Actor Class with Interaction Interface
This commit is contained in:
parent
ab76177b16
commit
dec1d761bf
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
(Stored with Git LFS)
Binary file not shown.
@ -6,13 +6,13 @@
|
|||||||
#include "MainBountyClass.h"
|
#include "MainBountyClass.h"
|
||||||
#include "SideBountyClass.h"
|
#include "SideBountyClass.h"
|
||||||
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
||||||
#include "EndlessVendetta/InteractableActor.h"
|
#include "EndlessVendetta/InteractionInterface.h"
|
||||||
#include "EndlessVendetta/UserWidgets/PC_Display.h"
|
#include "EndlessVendetta/UserWidgets/PC_Display.h"
|
||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
#include "BountyDirector.generated.h"
|
#include "BountyDirector.generated.h"
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class ENDLESSVENDETTA_API ABountyDirector : public AInteractableActor
|
class ENDLESSVENDETTA_API ABountyDirector : public AActor, public IInteractionInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "Components/CapsuleComponent.h"
|
#include "Components/CapsuleComponent.h"
|
||||||
#include "EnhancedInputComponent.h"
|
#include "EnhancedInputComponent.h"
|
||||||
#include "EnhancedInputSubsystems.h"
|
#include "EnhancedInputSubsystems.h"
|
||||||
#include "InteractableActor.h"
|
#include "InteractionInterface.h"
|
||||||
#include "AI/EnemyCharacter.h"
|
#include "AI/EnemyCharacter.h"
|
||||||
#include "GameFramework/CharacterMovementComponent.h"
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
@ -124,10 +124,8 @@ void AEndlessVendettaCharacter::Interact()
|
|||||||
if (!GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera, QueryParams)) return;
|
if (!GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera, QueryParams)) return;
|
||||||
|
|
||||||
AActor* HitActor = OutHit.GetActor();
|
AActor* HitActor = OutHit.GetActor();
|
||||||
AInteractableActor* InteractableActor = Cast<AInteractableActor>(HitActor);
|
IInteractionInterface* InteractableActor = Cast<IInteractionInterface>(HitActor);
|
||||||
if (!IsValid(InteractableActor)) return;
|
if (InteractableActor) InteractableActor->Interact();
|
||||||
|
|
||||||
InteractableActor->Interact();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
|
|
||||||
#include "InteractableActor.h"
|
|
||||||
|
|
||||||
// Sets default values
|
|
||||||
AInteractableActor::AInteractableActor()
|
|
||||||
{
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called when the game starts or when spawned
|
|
||||||
void AInteractableActor::BeginPlay()
|
|
||||||
{
|
|
||||||
Super::BeginPlay();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called every frame
|
|
||||||
void AInteractableActor::Tick(float DeltaTime)
|
|
||||||
{
|
|
||||||
Super::Tick(DeltaTime);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void AInteractableActor::Interact()
|
|
||||||
{
|
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Interacted with %s"), *GetName());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "GameFramework/Actor.h"
|
|
||||||
#include "InteractableActor.generated.h"
|
|
||||||
|
|
||||||
UCLASS()
|
|
||||||
class ENDLESSVENDETTA_API AInteractableActor : public AActor
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// Called when the game starts or when spawned
|
|
||||||
virtual void BeginPlay() override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// Sets default values for this actor's properties
|
|
||||||
AInteractableActor();
|
|
||||||
// Called every frame
|
|
||||||
virtual void Tick(float DeltaTime) override;
|
|
||||||
|
|
||||||
virtual void Interact();
|
|
||||||
|
|
||||||
};
|
|
@ -0,0 +1,6 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "InteractionInterface.h"
|
||||||
|
|
||||||
|
// Add default functionality here for any IInteractionInterface functions that are not pure virtual.
|
@ -0,0 +1,26 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "UObject/Interface.h"
|
||||||
|
#include "InteractionInterface.generated.h"
|
||||||
|
|
||||||
|
// This class does not need to be modified.
|
||||||
|
UINTERFACE(MinimalAPI)
|
||||||
|
class UInteractionInterface : public UInterface
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class ENDLESSVENDETTA_API IInteractionInterface
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
|
||||||
|
public:
|
||||||
|
virtual void Interact(){}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user