Finished Door opening mechanic
This commit is contained in:
parent
14c1874c53
commit
55e160eb80
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/DoorPrompt/BP_Door.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/DoorPrompt/BP_Door.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/DoorPrompt/WBP_DoorPrompt.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/DoorPrompt/WBP_DoorPrompt.uasset
(Stored with Git LFS)
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:162297ec59b7e47b42f34b19c64b0cbca86fcf80168764e5047cc45910cfe7da
|
||||
size 4366
|
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/DoorTestLevel/D/X5/OKD54JHXNGXNVF4JEBBMVP.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/DoorTestLevel/D/X5/OKD54JHXNGXNVF4JEBBMVP.uasset
(Stored with Git LFS)
Binary file not shown.
@ -3,6 +3,10 @@
|
||||
|
||||
#include "DoorClass.h"
|
||||
|
||||
#include "EndlessVendettaCharacter.h"
|
||||
#include "Components/ArrowComponent.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
// Sets default values
|
||||
ADoorClass::ADoorClass()
|
||||
{
|
||||
@ -16,33 +20,43 @@ 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;
|
||||
GLog->Log("Door has been interacted");
|
||||
bool bIsDoorOpen = false;
|
||||
if (!bIsDoorOpen)
|
||||
{
|
||||
|
||||
DoorOpeningAnim();
|
||||
bIsDoorOpen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DoorCloseAnim();
|
||||
bIsDoorOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ADoorClass::InteractPrompt()
|
||||
{
|
||||
if(bIsDoorOpen) return;
|
||||
DoorPrompt();
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ArrowComponent.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "EndlessVendetta/InteractionInterface.h"
|
||||
#include "DoorClass.generated.h"
|
||||
@ -21,6 +22,12 @@ public:
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
ACharacter* playerInWorld;
|
||||
|
||||
AEndlessVendettaCharacter* endlessVendettaChar;
|
||||
|
||||
UArrowComponent* FrontOfDoor;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
@ -33,4 +40,12 @@ public:
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void DoorPrompt();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void DoorOpeningAnim();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void DoorCloseAnim();
|
||||
|
||||
bool bIsDoorOpen = false;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user