diff --git a/EndlessVendetta/Content/BountySystem/CC_ReturnToShip.uasset b/EndlessVendetta/Content/BountySystem/CC_ReturnToShip.uasset index 9fce0370..610c41ad 100644 --- a/EndlessVendetta/Content/BountySystem/CC_ReturnToShip.uasset +++ b/EndlessVendetta/Content/BountySystem/CC_ReturnToShip.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7cad648008fd70041f5bf4f160cffa927427c047f41469065e52f61f4fbc5ac -size 22256 +oid sha256:2ff74658b687ff7bf8619b0b1cc1a4c086dee8fb5d7cd21fa820a7272b602721 +size 13616 diff --git a/EndlessVendetta/Content/BountySystem/TestBounties/Test_Bounty1/BC_TestBounty1.uasset b/EndlessVendetta/Content/BountySystem/TestBounties/Test_Bounty1/BC_TestBounty1.uasset index 6235ec12..3afe0b52 100644 --- a/EndlessVendetta/Content/BountySystem/TestBounties/Test_Bounty1/BC_TestBounty1.uasset +++ b/EndlessVendetta/Content/BountySystem/TestBounties/Test_Bounty1/BC_TestBounty1.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dd50cc9532eeeff9ce7cb812e9e03c28b92860a7793f37f4f39b9a061a0a075a -size 27020 +oid sha256:9e59c8ac9357ddb7da324f75e67b79e1dc430da18acb4638a82a7f6a0bb228f5 +size 26624 diff --git a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset index f281fcf6..9819ebfd 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:999086617d1b45a70b6fc5db1c639bfff0ec0bba5952340e163a1d5d8c21a206 -size 249 +oid sha256:a23fd0e2dcb1d9ef6281f8b224a2fac4c24819434c765688132505ba1439ff83 +size 66790690 diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp index ae8fbd8d..d1df86ae 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.cpp @@ -93,38 +93,4 @@ void ABountyClass::CollectRewards_Implementation() UE_LOG(LogTemp, Warning, TEXT("The player has gained $%d for completing the bounty!"), RewardMoney); } -void ABountyClass::UpdateBountyCheckpoints(TMap> ReplacementCheckpoints) -{ - if (ReplacementCheckpoints.IsEmpty()) - { - UE_LOG(LogTemp, Warning, TEXT("No Replacement Steps found")); - return; - } - - FActorSpawnParameters SpawnParameters; - SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; - - for (auto ReplacementCheckpoint : ReplacementCheckpoints) - { - BountyCheckpoints[ReplacementCheckpoint.Key]->Destroy(); - ReplacementCheckpointClass = ReplacementCheckpoint.Value; - - FVector Loc = ReplacementCheckpointClass.GetDefaultObject()->GetCheckpointSpawnTransform().GetLocation(); - FRotator Rot = ReplacementCheckpointClass.GetDefaultObject()->GetCheckpointSpawnTransform().GetRotation().Rotator(); - ACheckpointClass* SpawnedCheckpoint = Cast(GetWorld()->SpawnActor(ReplacementCheckpoint.Value, Loc, Rot, SpawnParameters)); - - if (SpawnedCheckpoint == nullptr) - { - UE_LOG(LogTemp, Fatal, TEXT("The new checkpoint hasn't spawned in properly or can't be cast to")); - return; - } - - BountyCheckpoints[ReplacementCheckpoint.Key] = SpawnedCheckpoint; - if (ReplacementCheckpoint.Key == 0) - { - BountyCheckpoints[ReplacementCheckpoint.Key]->Active = true; - BountyCheckpoints[ReplacementCheckpoint.Key]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint); - } - } -} diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h index 4f65bae9..8b910cc1 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h @@ -23,6 +23,9 @@ protected: // ------- Properties Set in Editor -------------- UPROPERTY(EditDefaultsOnly, Category = "Bounty") TArray> CheckpointsToSpawn; + + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + TArray> SideBountiesToSpawn; UPROPERTY(EditDefaultsOnly, Category = "Bounty") int RewardMoney = 0; @@ -62,6 +65,10 @@ public: return Completed; } + TArray> GetSideBountiesToSpawn() + { + return SideBountiesToSpawn; + } FString GetBountyTitle() { return BountyTitle; @@ -136,7 +143,4 @@ public: BountyCheckpoints[0]->Destroy(); } - - // Called by Bounty Director, replaces specified checkpoints to alter Bounty when player completes a side bounty - void UpdateBountyCheckpoints(TMap> ReplacementCheckpoints); }; diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp index 7cf44c2a..f14f4580 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp @@ -34,14 +34,7 @@ void ABountyDirector::BeginPlay() if (!IsValid(BountyAttachmentPoint)) UE_LOG(LogTemp, Fatal, TEXT("There's no Bounty Attachment UArrowComponent on Players Char ")); break; } - - // Setup up starting Side Bounty indexes - for (int Index = 0; Index < 3; Index++) - { - CurrentSideBountyIndexes.Add(Index); - } - - ActiveSideBounties.SetNum(3); + SpawnBountyAndItsSideBounties(); UpdateBountyDisplay(); } @@ -66,22 +59,16 @@ void ABountyDirector::SpawnBountyAndItsSideBounties() // WHEN MARCEL STOPS PLAYING WITH THE CHARACTER, ADD THIS BOUNTY TO PLAYERS ARRAY OF ACTIVE BOUNTIES!!!!! ActiveBounty->CompletedFirstCheckpoint.AddDynamic(this, &ABountyDirector::DestroyActiveSideBounties); - - // Spawn in Side Bounties which are linked to the Main Bounty - int ActiveSideBountyIndex = 0; - for (int CurrentSideBountyIndex : CurrentSideBountyIndexes) + ActiveSideBounties.Reset(); + for (TSubclassOf SideBountyClass : ActiveBounty->GetSideBountiesToSpawn()) { - if (SideBountyClassArray.Num() <= CurrentSideBountyIndex || !IsValid(SideBountyClassArray[CurrentSideBountyIndex])) continue; - - AActor* SideBountyActor = GetWorld()->SpawnActor(SideBountyClassArray[CurrentSideBountyIndex], PlayerChar->GetActorLocation(), PlayerChar->GetActorRotation(), SpawnParams); + if (!IsValid(SideBountyClass)) continue; + AActor* SideBountyActor = GetWorld()->SpawnActor(SideBountyClass, PlayerChar->GetActorLocation(), PlayerChar->GetActorRotation(), SpawnParams); + SideBountyActor->AttachToComponent(BountyAttachmentPoint, AttachmentTransformRules); ASideBountyClass* SideBounty = Cast(SideBountyActor); - SideBounty->AttachToComponent(BountyAttachmentPoint, AttachmentTransformRules); - - ActiveSideBounties[ActiveSideBountyIndex] = SideBounty; - SideBounty->ActiveSBC_Index = ActiveSideBountyIndex; - ActiveSideBounties[ActiveSideBountyIndex]->CompletedSideBounty.AddDynamic(this, &ABountyDirector::SideBountyCompleted); + if (!IsValid(SideBounty)) UE_LOG(LogTemp, Fatal, TEXT("A SideBounty for %s has been set to a wrong type"), *ActiveBounty->GetBountyTitle()); + ActiveSideBounties.Add(SideBounty); // ONCE AGAIN WHEN MARCEL STOPS PLAYING WITH THE CHARACTER, ADD THIS SIDE BOUNTY TO PLAYERS ARRAY OF ACTIVE BOUNTIES!!!!! - ActiveSideBountyIndex++; } } @@ -103,10 +90,6 @@ void ABountyDirector::FinishActiveBounty() // Increment Main and Side Bounty Indexes CurrentBountyIndex++; - for (int i = 0; i < 3; i++) - { - CurrentSideBountyIndexes[i] += 3; - } // Game Completion Check if (CurrentBountyIndex >= BountyClassArray.Num()) @@ -136,17 +119,5 @@ void ABountyDirector::DestroyActiveSideBounties() UpdateBountyDisplay(); } -void ABountyDirector::SideBountyCompleted(int SideBountyIndex) -{ - UE_LOG(LogTemp,Warning,TEXT("Updating Main Bounties Checkpoints")); - ActiveBounty->UpdateBountyCheckpoints(ActiveSideBounties[SideBountyIndex]->GetReplacementCheckpoints()); - - // WHEN MARCEL STOPS PLAYING WITH PLAYER CHAR, REMOVE THIS SIDE BOUNTY FROM ACTIVE BOUNTIES - ActiveSideBounties[SideBountyIndex]->CollectRewards(); - ActiveSideBounties[SideBountyIndex]->DestroyCheckpoints(); - ActiveSideBounties[SideBountyIndex]->Destroy(); - - UpdateBountyDisplay(); -} diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.h index c5c67311..14534e75 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.h @@ -23,14 +23,8 @@ class ENDLESSVENDETTA_API ABountyDirector : public AActor UPROPERTY(EditDefaultsOnly, Category = "Bounty") TArray> BountyClassArray; - // Ordered Array of Side Bounties, in three's - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - TArray> SideBountyClassArray; - int CurrentBountyIndex = 0; - TArray CurrentSideBountyIndexes; - UPROPERTY(VisibleAnywhere, Category = "Bounty") ABountyClass* ActiveBounty; @@ -54,11 +48,7 @@ protected: based on data from ActiveBC and ActiveSBC */ UFUNCTION(BlueprintImplementableEvent, Category = "bounty") void UpdateBountyDisplay(); - - // Ran when a Side Bounty is completed and wants to update the active bounties checkpoints - UFUNCTION() - void SideBountyCompleted(int SideBountyIndex); - + UFUNCTION() void DestroyActiveSideBounties(); @@ -93,6 +83,4 @@ public: { return (SideBountyIndex > 2 || SideBountyIndex < 0 || !IsValid(ActiveSideBounties[SideBountyIndex])) ? FString("N/A") : ActiveSideBounties[SideBountyIndex]->GetBountyDesc(); } - - };