From 546e7b4a6d99a300ec2159f7dd80a9e56bce1e66 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Wed, 11 Oct 2023 10:59:14 +0100 Subject: [PATCH] Created new Main Bounty Class Seperates new properties and behaviours associated with only the main bounties and not any other bounties --- .../Architecture/Floor_400x400.uasset | 4 +- .../HDRI/HDRI_Epic_Courtyard_Daylight.uasset | 4 +- .../BountySystem/BountyClass.cpp | 20 --- .../BountySystem/BountyClass.h | 105 +-------------- .../BountySystem/BountyDirector.cpp | 4 +- .../BountySystem/BountyDirector.h | 6 +- .../BountySystem/MainBountyClass.cpp | 24 ++++ .../BountySystem/MainBountyClass.h | 123 ++++++++++++++++++ 8 files changed, 157 insertions(+), 133 deletions(-) create mode 100644 EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp create mode 100644 EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index c2a34afc..c85fe9b1 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:460f12438b7058cfb92d3fde1df787aab7d49edd287ff1449947c28a25c95add +size 14831 diff --git a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset index 0c9d4e26..0f990580 100644 --- a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset +++ b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a25fb0509937f11c2ef9e1e717d9d14d1d41e26352da8353f1181fd19aa5c0d -size 66790690 +oid sha256:bc35eb2d43a47427d30aba0196f9eac90d089dd3abca319528c5d25c83510d0d +size 72364642 diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp index 35e32ac1..fe2a8c58 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp @@ -93,26 +93,6 @@ void ABountyClass::CollectRewards_Implementation() UE_LOG(LogTemp, Warning, TEXT("The player has gained $%d for completing the bounty!"), RewardMoney); } -void ABountyClass::BuySpawnAmmoDrops() -{ - FActorSpawnParameters SpawnParameters; - SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; - for (FTransform Spawn : AmmoDropSpawnTransforms) - { - GetWorld()->SpawnActor(AmmoDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters); - } -} - -void ABountyClass::BuySpawnHealthDrops() -{ - FActorSpawnParameters SpawnParameters; - SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; - for (FTransform Spawn : HealthDropSpawnTransforms) - { - GetWorld()->SpawnActor(HealthDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters); - } -} - diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h index d79cdd38..607d7945 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h @@ -23,9 +23,6 @@ protected: // ------- Properties Set in Editor -------------- UPROPERTY(EditDefaultsOnly, Category = "Bounty") TArray> CheckpointsToSpawn; - - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - TArray> SideBountiesToSpawn; UPROPERTY(EditDefaultsOnly, Category = "Bounty") int RewardMoney = 0; @@ -35,39 +32,6 @@ protected: UPROPERTY(EditDefaultsOnly, Category = "Bounty") FString BountyDesc; - // ---------------- Bounty Alterations ---------------- - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - FString CustomBountyAlteration_1_Description; - - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - int CustomBountyAlteration_1_Cost = 2; - - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - FString CustomBountyAlteration_2_Description; - - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - int CustomBountyAlteration_2_Cost = 2; - - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - FString CustomBountyAlteration_3_Description; - - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - int CustomBountyAlteration_3_Cost = 2; - - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - TArray AmmoDropSpawnTransforms; - - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - TSubclassOf AmmoDropClass; - - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - TArray HealthDropSpawnTransforms; - - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - TSubclassOf HealthDropClass; - - bool HasEnemyRadio = false; - // ----------------------------------------------- bool Completed = false; @@ -91,11 +55,7 @@ public: { return Completed; } - - TArray> GetSideBountiesToSpawn() - { - return SideBountiesToSpawn; - } + FString GetBountyTitle() { return BountyTitle; @@ -160,67 +120,4 @@ public: // Collect Money in C++, any other special reward will be implemented in BP if neccessary UFUNCTION(BlueprintCallable, BlueprintNativeEvent) void CollectRewards(); - - -// ------------- Custom Bounty Alterations ------------- - UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") - void BuyCustomBountyAlteration_1(); - - UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") - void BuyCustomBountyAlteration_2(); - - UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") - void BuyCustomBountyAlteration_3(); - - UFUNCTION(BlueprintCallable, Category = "Bounty") - FString GetCustomBountyAlteration_1_Description() - { - return CustomBountyAlteration_1_Description; - } - - UFUNCTION(BlueprintCallable, Category = "Bounty") - FString GetCustomBountyAlteration_2_Description() - { - return CustomBountyAlteration_2_Description; - } - - UFUNCTION(BlueprintCallable, Category = "Bounty") - FString GetCustomBountyAlteration_3_Description() - { - return CustomBountyAlteration_3_Description; - } - - UFUNCTION(BlueprintCallable, Category = "Bounty") - int GetCustomBountyAlteration_1_Cost() - { - return CustomBountyAlteration_1_Cost; - } - - UFUNCTION(BlueprintCallable, Category = "Bounty") - int GetCustomBountyAlteration_2_Cost() - { - return CustomBountyAlteration_2_Cost; - } - - UFUNCTION(BlueprintCallable, Category = "Bounty") - int GetCustomBountyAlteration_3_Cost() - { - return CustomBountyAlteration_3_Cost; - } -// ------------- Simple Bounty Alterations ------------- - - void BuySpawnAmmoDrops(); - - void BuySpawnHealthDrops(); - - void BuyEnemyRadio() - { - HasEnemyRadio = true; - } - - // Concerned Enemies will call this function, if true, play funny poop voice line and stop enemies from being concerned - bool CheckIfHasEnemyRadio() - { - return HasEnemyRadio; - }; }; diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp index 8708cf04..f2a11b38 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp @@ -54,13 +54,13 @@ void ABountyDirector::SpawnBountyAndItsSideBounties() const FAttachmentTransformRules AttachmentTransformRules(EAttachmentRule::SnapToTarget, true); BountyActor->AttachToComponent(BountyAttachmentPoint, AttachmentTransformRules); - ActiveBounty = Cast(BountyActor); + ActiveBounty = Cast(BountyActor); if (!IsValid(ActiveBounty)) UE_LOG(LogTemp, Fatal, TEXT("Failed to Cast to Bounty class")); // WHEN MARCEL STOPS PLAYING WITH THE CHARACTER, ADD THIS BOUNTY TO PLAYERS ARRAY OF ACTIVE BOUNTIES!!!!! ActiveBounty->CompletedFirstCheckpoint.AddDynamic(this, &ABountyDirector::DestroyActiveSideBounties); ActiveSideBounties.Reset(); - for (TSubclassOf SideBountyClass : ActiveBounty->GetSideBountiesToSpawn()) + for (TSubclassOf SideBountyClass : ActiveBounty->GetSideBountiesToSpawn()) { if (!IsValid(SideBountyClass)) continue; AActor* SideBountyActor = GetWorld()->SpawnActor(SideBountyClass, PlayerChar->GetActorLocation(), PlayerChar->GetActorRotation(), SpawnParams); diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.h index 04c04f42..08a92bc6 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.h @@ -3,7 +3,7 @@ #pragma once #include "CoreMinimal.h" -#include "BountyClass.h" +#include "MainBountyClass.h" #include "SideBountyClass.h" #include "EndlessVendetta/EndlessVendettaCharacter.h" #include "GameFramework/Actor.h" @@ -21,12 +21,12 @@ class ENDLESSVENDETTA_API ABountyDirector : public AActor // Ordered Array of Main Bounties UPROPERTY(EditDefaultsOnly, Category = "Bounty") - TArray> BountyClassArray; + TArray> BountyClassArray; int CurrentBountyIndex = 0; UPROPERTY(VisibleAnywhere, Category = "Bounty") - ABountyClass* ActiveBounty; + AMainBountyClass* ActiveBounty; UPROPERTY(VisibleAnywhere, Category = "Bounty") TArray ActiveSideBounties; diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp new file mode 100644 index 00000000..714fb672 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp @@ -0,0 +1,24 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "MainBountyClass.h" + +void AMainBountyClass::BuySpawnAmmoDrops() +{ + FActorSpawnParameters SpawnParameters; + SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + for (FTransform Spawn : AmmoDropSpawnTransforms) + { + GetWorld()->SpawnActor(AmmoDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters); + } +} + +void AMainBountyClass::BuySpawnHealthDrops() +{ + FActorSpawnParameters SpawnParameters; + SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + for (FTransform Spawn : HealthDropSpawnTransforms) + { + GetWorld()->SpawnActor(HealthDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters); + } +} \ No newline at end of file diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h new file mode 100644 index 00000000..a539b84c --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h @@ -0,0 +1,123 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "BountyClass.h" +#include "SideBountyClass.h" +#include "MainBountyClass.generated.h" + +/** + * + */ +UCLASS() +class ENDLESSVENDETTA_API AMainBountyClass : public ABountyClass +{ + GENERATED_BODY() + +protected: + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + TArray> SideBountiesToSpawn; + + // ---------------- Bounty Alterations ---------------- + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + FString CustomBountyAlteration_1_Description; + + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + int CustomBountyAlteration_1_Cost = 2; + + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + FString CustomBountyAlteration_2_Description; + + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + int CustomBountyAlteration_2_Cost = 2; + + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + FString CustomBountyAlteration_3_Description; + + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + int CustomBountyAlteration_3_Cost = 2; + + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + TArray AmmoDropSpawnTransforms; + + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + TSubclassOf AmmoDropClass; + + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + TArray HealthDropSpawnTransforms; + + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + TSubclassOf HealthDropClass; + + bool HasEnemyRadio = false; + +public: + TArray> GetSideBountiesToSpawn() + { + return SideBountiesToSpawn; + } + + // ------------- Custom Bounty Alterations ------------- + UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") + void BuyCustomBountyAlteration_1(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") + void BuyCustomBountyAlteration_2(); + + UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") + void BuyCustomBountyAlteration_3(); + + UFUNCTION(BlueprintCallable, Category = "Bounty") + FString GetCustomBountyAlteration_1_Description() + { + return CustomBountyAlteration_1_Description; + } + + UFUNCTION(BlueprintCallable, Category = "Bounty") + FString GetCustomBountyAlteration_2_Description() + { + return CustomBountyAlteration_2_Description; + } + + UFUNCTION(BlueprintCallable, Category = "Bounty") + FString GetCustomBountyAlteration_3_Description() + { + return CustomBountyAlteration_3_Description; + } + + UFUNCTION(BlueprintCallable, Category = "Bounty") + int GetCustomBountyAlteration_1_Cost() + { + return CustomBountyAlteration_1_Cost; + } + + UFUNCTION(BlueprintCallable, Category = "Bounty") + int GetCustomBountyAlteration_2_Cost() + { + return CustomBountyAlteration_2_Cost; + } + + UFUNCTION(BlueprintCallable, Category = "Bounty") + int GetCustomBountyAlteration_3_Cost() + { + return CustomBountyAlteration_3_Cost; + } + // ------------- Simple Bounty Alterations ------------- + + void BuySpawnAmmoDrops(); + + void BuySpawnHealthDrops(); + + void BuyEnemyRadio() + { + HasEnemyRadio = true; + } + + // Concerned Enemies will call this function, if true, play funny poop voice line and stop enemies from being concerned + bool CheckIfHasEnemyRadio() + { + return HasEnemyRadio; + }; + +};