From 971e28bb618d0ed62e3e25676169b28f41f5f976 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek Date: Thu, 2 Nov 2023 18:57:01 +0000 Subject: [PATCH] Implemented Ring Module Gadget Tutorial --- .../GadgetTutorial/Recon/GT_RingModule.uasset | 3 ++ .../GadgetTutorial/Recon/GT_VisionLink.uasset | 4 +-- .../BountySystem/Waypoint/BP_Waypoint.uasset | 4 +-- .../RingModule/RG_RingModule.uasset | 4 +-- .../VisionLink/RG_VisionLink.uasset | 4 +-- .../Content/Levels/TrainingFacility.umap | 2 +- .../Architecture/Floor_400x400.uasset | 4 +-- .../Particles/P_Ambient_Dust.uasset | 4 +-- .../GadgetTutorial/BaseGadgetTutorial.cpp | 18 +++++----- .../GadgetTutorial/BaseGadgetTutorial.h | 25 ++++++++----- .../GadgetTutorial/RingModuleTutorial.cpp | 27 ++++++++++++++ .../GadgetTutorial/RingModuleTutorial.h | 35 +++++++++++++++++++ .../GadgetTutorial/VisionLinkTutorial.cpp | 22 ++---------- .../GadgetTutorial/VisionLinkTutorial.h | 14 ++------ 14 files changed, 109 insertions(+), 61 deletions(-) create mode 100644 EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_RingModule.uasset create mode 100644 EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/RingModuleTutorial.cpp create mode 100644 EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/RingModuleTutorial.h diff --git a/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_RingModule.uasset b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_RingModule.uasset new file mode 100644 index 00000000..80344912 --- /dev/null +++ b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_RingModule.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:935f7575eb8438f8e3320206e83e54c726aacd8ba9dae894dcea2dfdeca4cb70 +size 130514 diff --git a/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_VisionLink.uasset b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_VisionLink.uasset index d37bf461..782c77cd 100644 --- a/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_VisionLink.uasset +++ b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_VisionLink.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4dfc52ea68790fe41a2183cebf9f3f1760c3cd066efe8459f7f116673f524040 -size 212777 +oid sha256:0caa776d680dfb23ead998fcd2fbc0c7a46ecf2ff4edff73e98c3e152a79088d +size 213629 diff --git a/EndlessVendetta/Content/BountySystem/Waypoint/BP_Waypoint.uasset b/EndlessVendetta/Content/BountySystem/Waypoint/BP_Waypoint.uasset index 090002c9..ba8534c6 100644 --- a/EndlessVendetta/Content/BountySystem/Waypoint/BP_Waypoint.uasset +++ b/EndlessVendetta/Content/BountySystem/Waypoint/BP_Waypoint.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25a58a287c0b4dc77f3e9bd3bde9fc9b9077deb1189e141c9e6161e75ff9d593 -size 49378 +oid sha256:04143e23cb9403f9ae001e7ab261a6c90a890df16f81eb00c35ae1e7305ed249 +size 49046 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset index 8f215cce..e5b9faad 100644 --- a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b412ab348368172b66065bc5a41820dd96efe68260518a5d47a63216b343c3ba -size 108251 +oid sha256:163e6c220966ca84c1c7e3f9ae176fe99bb0f7b8b364403ad5cf42f0272a87f0 +size 108688 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset index bf676207..aea6e927 100644 --- a/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f33dd03b39415d19a4fe13c124542d77eb6517c16ad6bc19177c5acb82fd82a2 -size 109451 +oid sha256:576cf6674035552a043dab60a2173beec40cf65683d138ad0df40f66fd48370b +size 108618 diff --git a/EndlessVendetta/Content/Levels/TrainingFacility.umap b/EndlessVendetta/Content/Levels/TrainingFacility.umap index a07f09a6..a76d9058 100644 --- a/EndlessVendetta/Content/Levels/TrainingFacility.umap +++ b/EndlessVendetta/Content/Levels/TrainingFacility.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eccb9b1edb192ea701130918efac376eee57496ac65768f76a09f95c956d84e6 +oid sha256:4c448a399e03e820c5867766611f78910e2811b96a3370f79410574bbaaf7279 size 607443 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index 334ef1da..c2a34afc 100644 --- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f92f2966cca96beb70e0aa05ba91f070f4fe6a57eae07edd60e1ee68138c0f10 -size 14831 +oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 +size 14948 diff --git a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset index bf2e4391..a5d257ad 100644 --- a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset +++ b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01ef616c7a8bd90cd1b7a13efb18a56f33346efbae51efa31f09804478b7621d -size 43456 +oid sha256:d287a8505cfb16ecf61e3f10562beda389f49bbcddbbc25f28aeaa5d1afe5f6c +size 53268 diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.cpp index 4f70168f..c19db9e1 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.cpp @@ -2,6 +2,7 @@ #include "BaseGadgetTutorial.h" +#include "EndlessVendetta/EndlessVendettaCharacter.h" // Sets default values ABaseGadgetTutorial::ABaseGadgetTutorial() @@ -16,14 +17,8 @@ ABaseGadgetTutorial::ABaseGadgetTutorial() void ABaseGadgetTutorial::BeginPlay() { Super::BeginPlay(); - -} - -// Called every frame -void ABaseGadgetTutorial::Tick(float DeltaTime) -{ - Super::Tick(DeltaTime); - + SetupTutorial(); + SetActorTickInterval(0.2); } void ABaseGadgetTutorial::SpawnNewWaypoint(FVector Loc, FString Desc) @@ -36,8 +31,15 @@ void ABaseGadgetTutorial::SpawnNewWaypoint(FVector Loc, FString Desc) WaypointActor->SetupWaypoint(WaypointIcon, Desc); } +void ABaseGadgetTutorial::FinishedTutorial() +{ + if (IsValid(WaypointActor)) WaypointActor->Destroy(); + CompletedGadgetTutorial.Broadcast(); +} void ABaseGadgetTutorial::DestroyTutorial() { + if (IsValid(WaypointActor)) WaypointActor->Destroy(); + DespawnEnemies(); Destroy(); } diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.h index 55a29f02..48965d8b 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.h +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.h @@ -15,30 +15,37 @@ class ENDLESSVENDETTA_API ABaseGadgetTutorial : public AActor GENERATED_BODY() protected: + AWaypointActor* WaypointActor; + UPROPERTY(EditDefaultsOnly, Category = "Gadget Tutorial") TSubclassOf WaypointClass; - - AWaypointActor* WaypointActor; UPROPERTY(EditDefaultsOnly, Category = "Gadget Tutorial") UTexture2D* WaypointIcon; - void SpawnNewWaypoint(FVector Loc, FString Desc); - - // Called when the game starts or when spawned virtual void BeginPlay() override; + + void SpawnNewWaypoint(FVector Loc, FString Desc); + // Stops tutorial clues from appearing and broadcasts completion + void FinishedTutorial(); + + // Spawns Enemies, sets waypoint locations, etc... + UFUNCTION(BlueprintImplementableEvent) + void SetupTutorial(); + + // Destroy's enemies and other separate spawned in elements by this tutorial class + UFUNCTION(BlueprintImplementableEvent) + void DespawnEnemies(); + public: // Sets default values for this actor's properties ABaseGadgetTutorial(); FCompletedGadgetTutorial CompletedGadgetTutorial; - - // Called every frame - virtual void Tick(float DeltaTime) override; - virtual void DestroyTutorial(); + void DestroyTutorial(); }; diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/RingModuleTutorial.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/RingModuleTutorial.cpp new file mode 100644 index 00000000..af94b353 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/RingModuleTutorial.cpp @@ -0,0 +1,27 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "RingModuleTutorial.h" +#include "EndlessVendetta/EndlessVendettaCharacter.h" + + +void ARingModuleTutorial::BeginPlay() +{ + Super::BeginPlay(); + GadgetManager = Cast(GetWorld()->GetFirstPlayerController()->GetPawn())->GadgetManager; + SpawnNewWaypoint(HackTargetWaypointLoc, HackTargetWaypointDesc); +} + +void ARingModuleTutorial::Tick(float DeltaSeconds) +{ + Super::Tick(DeltaSeconds); + + if (!GadgetManager->ReconInUse()) return; + + SpawnNewWaypoint(ResultWaypointLoc, ResultWaypointDesc); + SetActorTickEnabled(false); + FTimerHandle TimerHandle; + GetWorld()->GetTimerManager().SetTimer(TimerHandle, this, &ARingModuleTutorial::FinishedTutorial, 7.5); +} + + diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/RingModuleTutorial.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/RingModuleTutorial.h new file mode 100644 index 00000000..e4726f63 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/RingModuleTutorial.h @@ -0,0 +1,35 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "BaseGadgetTutorial.h" +#include "EndlessVendetta/GadgetSystem/GadgetManager.h" +#include "RingModuleTutorial.generated.h" + +/** + * + */ +UCLASS() +class ENDLESSVENDETTA_API ARingModuleTutorial : public ABaseGadgetTutorial +{ + GENERATED_BODY() + + AGadgetManager* GadgetManager; + + void BeginPlay() override; + + void Tick(float DeltaSeconds) override; + +protected: + UPROPERTY(EditDefaultsOnly, Category = "Gadget Tutorial") + FString HackTargetWaypointDesc; + UPROPERTY(EditDefaultsOnly, Category = "Gadget Tutorial") + FString ResultWaypointDesc; + + UPROPERTY(BlueprintReadWrite, Category = "Gadget Tutorial") + FVector HackTargetWaypointLoc; + UPROPERTY(BlueprintReadWrite, Category = "Gadget Tutorial") + FVector ResultWaypointLoc; + +}; diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.cpp index 61032a67..5791ef3e 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.cpp @@ -4,15 +4,13 @@ #include "VisionLinkTutorial.h" #include "EndlessVendetta/EndlessVendettaCharacter.h" -#include "EndlessVendetta/GadgetSystem/GadgetManager.h" #include "Kismet/KismetMathLibrary.h" void AVisionLinkTutorial::BeginPlay() { Super::BeginPlay(); - SpawnEnemiesAndSetupDefaults(); + GadgetManager = Cast(GetWorld()->GetFirstPlayerController()->GetPawn())->GadgetManager; SpawnNewWaypoint(GoToAreaWaypointLoc, GoToAreaWaypointDesc); - SetActorTickInterval(0.2); } void AVisionLinkTutorial::Tick(float DeltaSeconds) @@ -30,12 +28,10 @@ void AVisionLinkTutorial::Tick(float DeltaSeconds) PlayerWasInTutZone = true; // Check if players recon gadget (vision link) is in active - APawn* PlayerPawn = GetWorld()->GetFirstPlayerController()->GetPawn(); - AEndlessVendettaCharacter* EndlessVendettaCharacter = Cast(PlayerPawn); - AGadgetManager* GadgetManager = EndlessVendettaCharacter->GadgetManager; if (!GadgetManager->ReconInUse()) return; // Check if the player is roughly looking at their target + APawn* PlayerPawn = GetWorld()->GetFirstPlayerController()->GetPawn(); FRotator LookAtRot = UKismetMathLibrary::FindLookAtRotation(PlayerPawn->GetActorLocation(), TargetLoc); FRotator PlayersRotator = PlayerPawn->GetActorRotation(); // Keep all yaw values between -180 and 180 to simplify the comparison @@ -53,19 +49,5 @@ void AVisionLinkTutorial::Tick(float DeltaSeconds) -void AVisionLinkTutorial::DestroyTutorial() -{ - if (IsValid(WaypointActor)) WaypointActor->Destroy(); - DespawnEnemies(); - Super::DestroyTutorial(); -} - -void AVisionLinkTutorial::FinishedTutorial() -{ - if (IsValid(WaypointActor)) WaypointActor->Destroy(); - CompletedGadgetTutorial.Broadcast(); -} - - diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.h index 48bbbd99..5876dad0 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.h +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "BaseGadgetTutorial.h" +#include "EndlessVendetta/GadgetSystem/GadgetManager.h" #include "VisionLinkTutorial.generated.h" UCLASS() @@ -11,16 +12,15 @@ class ENDLESSVENDETTA_API AVisionLinkTutorial : public ABaseGadgetTutorial { GENERATED_BODY() - bool PlayerInTutorialZone = false; + AGadgetManager* GadgetManager; + bool PlayerInTutorialZone = false; bool PlayerWasInTutZone = false; void BeginPlay() override; void Tick(float DeltaSeconds) override; - void DestroyTutorial() override; - protected: UPROPERTY(EditDefaultsOnly) FString GoToAreaWaypointDesc; @@ -38,12 +38,6 @@ protected: UPROPERTY(BlueprintReadWrite) FVector TargetLoc; - - // Spawns enemies, sets up waypoint locs, and target loc - UFUNCTION(BlueprintImplementableEvent) - void SpawnEnemiesAndSetupDefaults(); - UFUNCTION(BlueprintImplementableEvent) - void DespawnEnemies(); UFUNCTION(BlueprintCallable) void PlayerEnteredTutorialZone() @@ -55,6 +49,4 @@ protected: { PlayerInTutorialZone = false; } - - void FinishedTutorial(); };