diff --git a/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/BP_InfiniteHealthEnemy.uasset b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/BP_InfiniteHealthEnemy.uasset new file mode 100644 index 00000000..3ac4ffc8 --- /dev/null +++ b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/BP_InfiniteHealthEnemy.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff0184855d0b831ff073d507262a1297f3fd676f49a4ec28ded918fbb8896069 +size 42127 diff --git a/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/BP_ReconWorkbench.uasset b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/BP_ReconWorkbench.uasset index 7efaf4aa..546a248e 100644 --- a/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/BP_ReconWorkbench.uasset +++ b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/BP_ReconWorkbench.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aca420300ee672cc466a648e1630d1fe57242f3f601751620e4d4336652b2a3f -size 23371 +oid sha256:191a1e2ab132262fdd234e16a45508f0bff1cc081c977e49cffba1c4017bb052 +size 2801 diff --git a/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/GadgetTutorialIcon.png b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/GadgetTutorialIcon.png new file mode 100644 index 00000000..befb3dc2 --- /dev/null +++ b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/GadgetTutorialIcon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d45db118dff139dba8afcbb4bccae0415e6ce9522753bc8dc321947309b987a4 +size 39589 diff --git a/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/GadgetTutorialIcon.uasset b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/GadgetTutorialIcon.uasset new file mode 100644 index 00000000..1f6752b4 --- /dev/null +++ b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/GadgetTutorialIcon.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1aee6585c4133154fec11fcd690c3526714b66b588b9376faa7747e52abf4dea +size 39732 diff --git a/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/BP_ReconWorkbench.uasset b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/BP_ReconWorkbench.uasset new file mode 100644 index 00000000..20b5b980 --- /dev/null +++ b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/BP_ReconWorkbench.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e7084fab6eb5149aef1ebd8b44303477718dd4b17e59faea6c7800ed62e0847 +size 23596 diff --git a/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_VisionLink.uasset b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_VisionLink.uasset new file mode 100644 index 00000000..d37bf461 --- /dev/null +++ b/EndlessVendetta/Content/BountySystem/TutorialFacility/Checkpoints/GadgetTutorial/Recon/GT_VisionLink.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dfc52ea68790fe41a2183cebf9f3f1760c3cd066efe8459f7f116673f524040 +size 212777 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset index 68f69959..bf676207 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:27d39fdab60fb9511fcfe760ba9180190bdbe16c5f1f62357f88de13800d47b7 -size 108912 +oid sha256:f33dd03b39415d19a4fe13c124542d77eb6517c16ad6bc19177c5acb82fd82a2 +size 109451 diff --git a/EndlessVendetta/Content/Levels/TrainingFacility.umap b/EndlessVendetta/Content/Levels/TrainingFacility.umap index 54c7d2b2..a07f09a6 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:5865096b570bd55d2eb3055389ccd4c7f9db407bb3f830746a5736a47d34253a -size 607074 +oid sha256:eccb9b1edb192ea701130918efac376eee57496ac65768f76a09f95c956d84e6 +size 607443 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index c2a34afc..334ef1da 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:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 -size 14948 +oid sha256:f92f2966cca96beb70e0aa05ba91f070f4fe6a57eae07edd60e1ee68138c0f10 +size 14831 diff --git a/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset b/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset index bf29e55a..56bddfc9 100644 --- a/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset +++ b/EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:36cd87b4220e1e08e73ba8c88cc787df6058fcd0cdf7ced1c255ba99da2cc189 -size 47710 +oid sha256:3a8777c01491888bba9f40eda9d2bed76a611f0e80f75917501ce69c1a321342 +size 47333 diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.h index 0dba8a7b..cc9b5e6a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/WaypointActor.h @@ -19,10 +19,10 @@ class ENDLESSVENDETTA_API AWaypointActor : public AActor float ScalingY_Intercept; UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling") - float MaxDist = 8000.f; + float MaxDist = 16000.f; UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling") - float ScaleAtMaxDist = 8.f; + float ScaleAtMaxDist = 4.f; UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling") float MinDist = 900.f; diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index 132d9d03..3761ba79 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -423,8 +423,8 @@ bool AEndlessVendettaCharacter::GetHasRifle() bool AEndlessVendettaCharacter::UpdateGadgetType(TSubclassOf NewGadgetClass) { - if (NewGadgetClass.GetDefaultObject()->IsA(AReconGadget::StaticClass()) && GadgetManager->CantReplaceReconGadget()) return false; - if (NewGadgetClass.GetDefaultObject()->IsA(ACombatGadget::StaticClass()) && GadgetManager->CantReplaceCombatGadget()) return false; + if (NewGadgetClass.GetDefaultObject()->IsA(AReconGadget::StaticClass()) && GadgetManager->ReconCantBeSwitchedOut()) return false; + if (NewGadgetClass.GetDefaultObject()->IsA(ACombatGadget::StaticClass()) && GadgetManager->CombatCantBeSwitchedOut()) return false; for (UActorComponent* PlayersCamera : GetComponentsByTag(UCameraComponent::StaticClass(), FName("PlayersCamera"))) { diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h index 6eca7b5f..9995a4f5 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h @@ -87,10 +87,11 @@ protected: UPROPERTY(EditDefaultsOnly, Category = "Gadget") TSubclassOf GadgetManagerClass; - AGadgetManager* GadgetManager; + public: - int Money = 2000; + int Money = 2000; + AGadgetManager* GadgetManager; bool bIsReloading = false; /** Look Input Action */ diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetManager.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetManager.h index 176331a9..d533215f 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetManager.h +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetManager.h @@ -78,16 +78,24 @@ public: return false; } - bool CantReplaceReconGadget() + bool ReconInUse() { - // Cant be replaced if it exists, and is either in use whilst being unequippable in use, or equipped and cant be unequipped - return IsValidReconGadget() && (ReconGadget->IsInUse() && ReconGadget->IsUnequippableInUse() || IsReconEquipped() && !TryToUnequipRecon()); + return IsValidReconGadget() && ReconGadget->IsInUse(); } - bool CantReplaceCombatGadget() + bool CombatInUse() { - // Cant be replaced if it exists, and is either in use whilst being unequippable in use, or equipped and cant be unequipped - return IsValidCombatGadget() && (CombatGadget->IsInUse() && CombatGadget->IsUnequippableInUse() || IsCombatEquipped() && !TryToUnequipCombat()); + return IsValidCombatGadget() && CombatGadget->IsInUse(); + } + + bool ReconCantBeSwitchedOut() + { + return IsValidReconGadget() && (ReconGadget->IsInUse() || (ReconGadget->Equipped && !TryToUnequipRecon())); + } + + bool CombatCantBeSwitchedOut() + { + return IsValidCombatGadget() && (CombatGadget->IsInUse() || (CombatGadget->Equipped && !TryToUnequipCombat())); } }; diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.cpp index d40f6b97..4f70168f 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.cpp @@ -8,6 +8,7 @@ ABaseGadgetTutorial::ABaseGadgetTutorial() { // 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; + bAllowTickBeforeBeginPlay = false; } @@ -25,8 +26,18 @@ void ABaseGadgetTutorial::Tick(float DeltaTime) } +void ABaseGadgetTutorial::SpawnNewWaypoint(FVector Loc, FString Desc) +{ + if (IsValid(WaypointActor)) WaypointActor->Destroy(); + + FActorSpawnParameters SpawnParams; + SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + WaypointActor = Cast(GetWorld()->SpawnActor(WaypointClass, Loc, GetActorRotation(), SpawnParams)); + WaypointActor->SetupWaypoint(WaypointIcon, Desc); +} + + void ABaseGadgetTutorial::DestroyTutorial() { - UE_LOG(LogTemp, Warning, TEXT("Destroyed Tutorial")); Destroy(); } diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.h index 862ed99b..55a29f02 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.h +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/BaseGadgetTutorial.h @@ -3,33 +3,42 @@ #pragma once #include "CoreMinimal.h" +#include "EndlessVendetta/BountySystem/WaypointActor.h" #include "GameFramework/Actor.h" #include "BaseGadgetTutorial.generated.h" +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedGadgetTutorial) + UCLASS() class ENDLESSVENDETTA_API ABaseGadgetTutorial : public AActor { GENERATED_BODY() - UPROPERTY(EditDefaultsOnly, Category = "Gadget Tutorial") - FTransform SpawnTransform; - protected: + 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; public: // Sets default values for this actor's properties ABaseGadgetTutorial(); + + FCompletedGadgetTutorial CompletedGadgetTutorial; // Called every frame virtual void Tick(float DeltaTime) override; virtual void DestroyTutorial(); - - FTransform GetSpawnTransform() - { - return SpawnTransform; - } + }; diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/GadgetTutorialStation.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/GadgetTutorialStation.cpp index 6bb620d4..0adb8cb0 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/GadgetTutorialStation.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/GadgetTutorialStation.cpp @@ -94,8 +94,8 @@ void AGadgetTutorialStation::SelectGadget() FActorSpawnParameters SpawnParams; SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; TSubclassOf GadgetTutorialToSpawnInClass = GadgetsArray[GadgetIndex]->GetDefaultObject()->GadgetTutorialClass; - FTransform SpawnTransform = GadgetTutorialToSpawnInClass->GetDefaultObject()->GetSpawnTransform(); - AActor* GadgetTutorialActor = GetWorld()->SpawnActor(GadgetTutorialToSpawnInClass, SpawnTransform.GetLocation(), SpawnTransform.GetRotation().Rotator(), SpawnParams); + if (!IsValid(GadgetTutorialToSpawnInClass)) return; + AActor* GadgetTutorialActor = GetWorld()->SpawnActor(GadgetTutorialToSpawnInClass, GadgetTutorialSpawnTransform.GetLocation(), GadgetTutorialSpawnTransform.GetRotation().Rotator(), SpawnParams); CurrentGadgetTutorial = Cast(GadgetTutorialActor); } diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/GadgetTutorialStation.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/GadgetTutorialStation.h index c44e494d..f59f4fc7 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/GadgetTutorialStation.h +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/GadgetTutorialStation.h @@ -24,6 +24,9 @@ class ENDLESSVENDETTA_API AGadgetTutorialStation : public AActor, public IIntera UPROPERTY(EditDefaultsOnly, Category = "Gadgets") TSubclassOf PickGadgetWidgetClass; + UPROPERTY(EditDefaultsOnly, Category = "Gadgets") + FTransform GadgetTutorialSpawnTransform; + int GadgetIndex = 0; UUserWidget* PickGadgetWidget; diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.cpp b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.cpp new file mode 100644 index 00000000..61032a67 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.cpp @@ -0,0 +1,71 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "VisionLinkTutorial.h" + +#include "EndlessVendetta/EndlessVendettaCharacter.h" +#include "EndlessVendetta/GadgetSystem/GadgetManager.h" +#include "Kismet/KismetMathLibrary.h" + +void AVisionLinkTutorial::BeginPlay() +{ + Super::BeginPlay(); + SpawnEnemiesAndSetupDefaults(); + SpawnNewWaypoint(GoToAreaWaypointLoc, GoToAreaWaypointDesc); + SetActorTickInterval(0.2); +} + +void AVisionLinkTutorial::Tick(float DeltaSeconds) +{ + Super::Tick(DeltaSeconds); + + if (!PlayerInTutorialZone) + { + if (PlayerWasInTutZone) SpawnNewWaypoint(GoToAreaWaypointLoc, GoToAreaWaypointDesc); + PlayerWasInTutZone = false; + return; + } + + if (!PlayerWasInTutZone) SpawnNewWaypoint(LookAtTargetWaypointLoc, LookAtTargetWaypointDesc); + 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 + FRotator LookAtRot = UKismetMathLibrary::FindLookAtRotation(PlayerPawn->GetActorLocation(), TargetLoc); + FRotator PlayersRotator = PlayerPawn->GetActorRotation(); + // Keep all yaw values between -180 and 180 to simplify the comparison + float DesiredtYaw = LookAtRot.Yaw - (LookAtRot.Yaw > 180 ? 360 : 0); + float PlayersYaw = PlayersRotator.Yaw - (PlayersRotator.Yaw > 180 ? 360 : 0); + // Do nothing if players yaw is off by more than 45 degrees + if (FMath::Abs(DesiredtYaw - PlayersYaw) > 45) return; + + + SpawnNewWaypoint(ResultWaypointLoc, ResultWaypointDesc); + FTimerHandle TimerHandle; + GetWorld()->GetTimerManager().SetTimer(TimerHandle, this, &AVisionLinkTutorial::FinishedTutorial, 7.5); + SetActorTickEnabled(false); +} + + + +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 new file mode 100644 index 00000000..48bbbd99 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetTutorial/VisionLinkTutorial.h @@ -0,0 +1,60 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "BaseGadgetTutorial.h" +#include "VisionLinkTutorial.generated.h" + +UCLASS() +class ENDLESSVENDETTA_API AVisionLinkTutorial : public ABaseGadgetTutorial +{ + GENERATED_BODY() + + bool PlayerInTutorialZone = false; + + bool PlayerWasInTutZone = false; + + void BeginPlay() override; + + void Tick(float DeltaSeconds) override; + + void DestroyTutorial() override; + +protected: + UPROPERTY(EditDefaultsOnly) + FString GoToAreaWaypointDesc; + UPROPERTY(EditDefaultsOnly) + FString LookAtTargetWaypointDesc; + UPROPERTY(EditDefaultsOnly) + FString ResultWaypointDesc; + + UPROPERTY(BlueprintReadWrite) + FVector GoToAreaWaypointLoc; + UPROPERTY(BlueprintReadWrite) + FVector LookAtTargetWaypointLoc; + UPROPERTY(BlueprintReadWrite) + FVector ResultWaypointLoc; + + 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() + { + PlayerInTutorialZone = true; + } + UFUNCTION(BlueprintCallable) + void PlayerLeftTutorialZone() + { + PlayerInTutorialZone = false; + } + + void FinishedTutorial(); +};