Implemented Entering Apartment Through Vent Functionality

This commit is contained in:
Rafal Swierczek 2024-04-14 20:01:09 +01:00
parent dfe50b6548
commit acafc375d2
14 changed files with 58 additions and 29 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8cb0a97f1dd101c47bcf0507886ef4490543549181f2c8bb287089ad768a7518
size 34179
oid sha256:123098c81e710146723e193f367e1a4e2da65cacca48bf37d97c40e85bcf9dca
size 35424

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ce69e2ea1ad759c5405fb0414aebf0bdcafdbe0420328736cedba27b41528521
size 27320
oid sha256:14cb75883d3e5bf3ca40441a9794c0e14a662b30170a45cadbb3d63a3271b83b
size 36526

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ba1cd4efcaef5498d769e1db299d043470a1e6fa9bbe2b54927ed2962d4361dd
size 41739957
oid sha256:abff5f3419d080ed1bf2fe3f817bd0d67983bd472e364dc44c671829b3f736df
size 41740404

View File

@ -3,6 +3,9 @@
#include "ConstructionVent.h"
#include "EndlessVendetta/EndlessVendettaCharacter.h"
#include "Kismet/GameplayStatics.h"
// Sets default values
AConstructionVent::AConstructionVent()
{
@ -11,22 +14,27 @@ AConstructionVent::AConstructionVent()
}
// Called when the game starts or when spawned
void AConstructionVent::BeginPlay()
{
Super::BeginPlay();
}
void AConstructionVent::Interact()
{
UE_LOG(LogTemp, Warning, TEXT("Interacting with VENT...sus"));
APawn* PlayerPawn = GetWorld()->GetFirstPlayerController()->GetPawn();
UInventoryComponent* PlayersInventory = Cast<UInventoryComponent>(PlayerPawn->GetComponentByClass(UInventoryComponent::StaticClass()));
if (PlayersInventory->HasItemByItemID(6971))
{
Cast<UEVGameInstance>(GetGameInstance())->EnteredApartmentThroughVent = true;
for (auto Item : PlayersInventory->GetAllItems())
{
if (Cast<UBaseItem>(Item.Key)->ItemID == 6971)
{
PlayersInventory->RemoveItem(Item.Key);
break;
}
}
EnterApartmentThroughVent();
}
else
{
FailToEnterVent();
}
}
// Called every frame
void AConstructionVent::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

View File

@ -17,13 +17,13 @@ public:
AConstructionVent();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void Interact() override;
UFUNCTION(BlueprintImplementableEvent)
void EnterApartmentThroughVent();
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UFUNCTION(BlueprintImplementableEvent)
void FailToEnterVent();
};

View File

@ -46,6 +46,9 @@ public:
UFUNCTION(BlueprintCallable, Category = "DialogueFlags")
bool HasDialogueFlag(EDialogueFlag Flag) const;
UPROPERTY(BlueprintReadOnly)
bool EnteredApartmentThroughVent = false;
protected:
virtual void OnStart() override;