Updated all Classes to have new Interface Function

This commit is contained in:
MARCEL HARA 2023-10-19 11:19:12 +01:00
parent dec1d761bf
commit a9eb6e3eea
11 changed files with 62 additions and 7 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:754ba6fc86e8d96dbe2fade3d515f45b10eefd1e3c7ac9115658daa2b251622e
size 76327
oid sha256:4b77951badd74210f53986b352ed4a4f92520b0ac247bea02c8fe39c6fba0f98
size 78642

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1b199cbe84b6c49806f9646990c9c60ff7199214add19091ea0d7a47896daf53
size 64350
oid sha256:10ebd683496c3f12941f3983445288dce63f61464dea90cf666d51f7faf23919
size 64526

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:53e04069ebf540b1eabcc5f7443809ad8ce7220ad0c86c39bca7befee2fc4ac6
size 21759

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:609efdd8d33b3e588fab3798c966b543cb353408d1aa6d8f78e1e50aed3e8c1c
size 298511
oid sha256:e1a60c21cb9af1f0efba0eed08d7f08e957185d81139c861473115ec2b2b578d
size 301542

View File

@ -266,6 +266,11 @@ void ABountyDirector::Interact()
PC_Display->LoadOS();
}
void ABountyDirector::InteractPrompt()
{
}
void ABountyDirector::DestroyBountyDirectorPCWidget()
{
if (IsValid(PC_DisplayWidget)) PC_DisplayWidget->RemoveFromParent();

View File

@ -54,6 +54,8 @@ class ENDLESSVENDETTA_API ABountyDirector : public AActor, public IInteractionIn
// Opens up Bounty Director PC Interface
void Interact() override;
// Prompts player to interact
void InteractPrompt() override;
protected:
int Favours = 20;

View File

@ -69,6 +69,24 @@ void AEndlessVendettaCharacter::BeginPlay()
void AEndlessVendettaCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
WeaponPickUpSystem();
}
void AEndlessVendettaCharacter::WeaponPickUpSystem()
{
FHitResult OutHit;
FCollisionQueryParams QueryParams = FCollisionQueryParams::DefaultQueryParam;
QueryParams.AddIgnoredActor(this);
FVector LT_Start = FirstPersonCameraComponent->GetComponentLocation();
FVector LT_End = LT_Start + (FirstPersonCameraComponent->GetForwardVector() * InteractionRange);
if (!GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera, QueryParams)) return;
AActor* HitActor = OutHit.GetActor();
UE_LOG(LogTemp, Warning, TEXT("Hit actor: %s"), *HitActor->GetName());
IInteractionInterface* InteractableActor = Cast<IInteractionInterface>(HitActor);
if (InteractableActor) InteractableActor->InteractPrompt();
}
//////////////////////////////////////////////////////////////////////////// Input
@ -124,6 +142,7 @@ void AEndlessVendettaCharacter::Interact()
if (!GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera, QueryParams)) return;
AActor* HitActor = OutHit.GetActor();
UE_LOG(LogTemp, Warning, TEXT("Hit actor: %s"), *HitActor->GetName());
IInteractionInterface* InteractableActor = Cast<IInteractionInterface>(HitActor);
if (InteractableActor) InteractableActor->Interact();
}
@ -151,6 +170,7 @@ float AEndlessVendettaCharacter::TakeDamage(const float DamageAmount, FDamageEve
return Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);
}
void AEndlessVendettaCharacter::ToggleRecon()
{
if (IsValid(PrimaryWeapon)) EquipPrimary();

View File

@ -173,4 +173,6 @@ public:
UFUNCTION(BlueprintCallable, Category = "Damage Control")
virtual float TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser) override;
void WeaponPickUpSystem();
};

View File

@ -23,4 +23,7 @@ class ENDLESSVENDETTA_API IInteractionInterface
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:
virtual void Interact(){}
virtual void InteractPrompt() {}
};

View File

@ -230,4 +230,17 @@ void ABaseWeaponClass::WeaponReload()
}
}
void ABaseWeaponClass::Interact()
{
GLog->Log("Interact Called");
}
void ABaseWeaponClass::InteractPrompt()
{
WeaponStatsPopUp();
UE_LOG(LogTemp, Warning, TEXT("InteractPrompt setup"))
}

View File

@ -6,13 +6,14 @@
#include "WeaponItemClass.h"
#include "Components/ArrowComponent.h"
#include "Kismet/KismetMathLibrary.h"
#include "EndlessVendetta/InteractionInterface.h"
#include "BaseWeaponClass.generated.h"
class AEndlessVendettaCharacter;
class UCapsuleComponent;
UCLASS()
class ENDLESSVENDETTA_API ABaseWeaponClass : public AActor
class ENDLESSVENDETTA_API ABaseWeaponClass : public AActor, public IInteractionInterface
{
GENERATED_BODY()
@ -156,6 +157,12 @@ public:
UPROPERTY(EditAnywhere)
int bulletCountShoot; //Gets how many bullets shot per
void Interact() override;
void InteractPrompt() override;
UFUNCTION(BlueprintImplementableEvent)
void WeaponStatsPopUp();
protected:
UArrowComponent* GunStartArrow;