From c6db0146e4a48c34d044ad7e5e62e9251bdadd63 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek <34179rs@gmail.com> Date: Tue, 10 Oct 2023 19:54:01 +0100 Subject: [PATCH] Implemented Simple Bounty Alterations --- .../BountySystem/BountyClass.cpp | 22 ++++ .../BountySystem/BountyClass.h | 101 ++++++++++++++---- 2 files changed, 102 insertions(+), 21 deletions(-) diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp index a115427a..35e32ac1 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp @@ -93,4 +93,26 @@ 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 40f2ff03..d79cdd38 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h @@ -35,15 +35,38 @@ protected: UPROPERTY(EditDefaultsOnly, Category = "Bounty") FString BountyDesc; + // ---------------- Bounty Alterations ---------------- + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + FString CustomBountyAlteration_1_Description; UPROPERTY(EditDefaultsOnly, Category = "Bounty") - FString CustomAlteringEffect1_Description; + int CustomBountyAlteration_1_Cost = 2; UPROPERTY(EditDefaultsOnly, Category = "Bounty") - FString CustomAlteringEffect2_Description; + FString CustomBountyAlteration_2_Description; UPROPERTY(EditDefaultsOnly, Category = "Bounty") - FString CustomAlteringEffect3_Description; + 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; // ----------------------------------------------- @@ -138,30 +161,66 @@ public: UFUNCTION(BlueprintCallable, BlueprintNativeEvent) void CollectRewards(); - UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") - void CustomBountyAlteringEffect1(); - UFUNCTION(BlueprintCallable, Category = "Bounty") - FString GetCustomBountyAlteringEffect1_Description() - { - return CustomAlteringEffect1_Description; - } +// ------------- Custom Bounty Alterations ------------- + UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") + void BuyCustomBountyAlteration_1(); UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") - void CustomBountyAlteringEffect2(); - - UFUNCTION(BlueprintCallable, Category = "Bounty") - FString GetCustomBountyAlteringEffect2_Description() - { - return CustomAlteringEffect2_Description; - } - + void BuyCustomBountyAlteration_2(); + UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") - void CustomBountyAlteringEffect3(); + void BuyCustomBountyAlteration_3(); UFUNCTION(BlueprintCallable, Category = "Bounty") - FString GetCustomBountyAlteringEffect3_Description() + FString GetCustomBountyAlteration_1_Description() { - return CustomAlteringEffect3_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; + }; };