Merge branch 'door-mechanic' into dev

This commit is contained in:
MH261677 2023-11-21 14:36:24 +00:00
commit 5bdee1fbaf
85 changed files with 351 additions and 18 deletions

Binary file not shown.

Binary file not shown.

BIN
EndlessVendetta/Content/Levels/DoorTestLevel.umap (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,64 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "DoorClass.h"
#include "EndlessVendettaCharacter.h"
#include "Components/ArrowComponent.h"
#include "Kismet/GameplayStatics.h"
// Sets default values
ADoorClass::ADoorClass()
{
// 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 ADoorClass::BeginPlay()
{
Super::BeginPlay();
// Attempt to find the player character
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);
playerInWorld = Cast<AEndlessVendettaCharacter>(PlayerController->GetCharacter());
endlessVendettaChar = Cast<AEndlessVendettaCharacter>(playerInWorld);
for (UActorComponent* actorComp : playerInWorld->GetComponentsByTag(UArrowComponent::StaticClass(), FName("FrontOfDoor")))
{
FrontOfDoor = Cast<UArrowComponent>(actorComp);
break;
}
}
// Called every frame
void ADoorClass::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ADoorClass::Interact()
{
if (!IsValid(this)) return;
if (!bIsDoorOpen)
{
DoorOpeningAnim();
bIsDoorOpen = true;
}
else
{
DoorCloseAnim();
bIsDoorOpen = false;
}
}
void ADoorClass::InteractPrompt()
{
if(bIsDoorOpen) return;
DoorPrompt();
}

View File

@ -0,0 +1,51 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ArrowComponent.h"
#include "GameFramework/Actor.h"
#include "EndlessVendetta/InteractionInterface.h"
#include "DoorClass.generated.h"
class AEndlessVendettaCharacter;
UCLASS()
class ENDLESSVENDETTA_API ADoorClass : public AActor, public IInteractionInterface
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ADoorClass();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
ACharacter* playerInWorld;
AEndlessVendettaCharacter* endlessVendettaChar;
UArrowComponent* FrontOfDoor;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
void Interact() override;
void InteractPrompt() override;
UFUNCTION(BlueprintImplementableEvent)
void DoorPrompt();
UFUNCTION(BlueprintImplementableEvent)
void DoorOpeningAnim();
UFUNCTION(BlueprintImplementableEvent)
void DoorCloseAnim();
bool bIsDoorOpen = false;
};

View File

@ -241,7 +241,6 @@ void ABaseWeaponClass::WeaponReload()
void ABaseWeaponClass::Interact()
{
if(!IsValid(this)) return;
GLog->Log("Interact Called");
endlessVendettaChar->WeaponSwitcher(this);
}