diff --git a/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml b/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml index 5cc0abdd..932bc015 100644 --- a/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml +++ b/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml @@ -9,9 +9,13 @@ - - - + + + + + + + diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h index d34e4c77..06bcc3bb 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h @@ -24,7 +24,11 @@ class ENDLESSVENDETTA_API ABountyClass : public AActor protected: // Array of References to the Spawned in Checkpoints for this Bounty TArray BountyCheckpoints; - + + // Money Rewarded to Player for Completing this Bounty + UPROPERTY(EditDefaultsOnly, Category = "Bounty") + int RewardMoney = 0; + public: FCompletedACheckpoint CompletedACheckpoint; @@ -64,8 +68,7 @@ protected: // ------- Properties Set in Editor -------------- - UPROPERTY(EditDefaultsOnly, Category = "Bounty") - int RewardMoney = 0; + UPROPERTY(EditDefaultsOnly, Category = "Bounty") FString BountyTitle; diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp index 834c7fb5..d9745afb 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyDirector.cpp @@ -68,7 +68,7 @@ void ABountyDirector::SpawnBountyAndItsSideBounties() ASideBountyClass* SideBounty = Cast(SideBountyActor); if (!IsValid(SideBounty)) UE_LOG(LogTemp, Fatal, TEXT("A SideBounty for %s has been set to a wrong type"), *ActiveBounty->GetBountyTitle()); int i = ActiveSideBounties.Add(SideBounty); - ActiveSideBounties[i]->CompletedSideBounty.AddDynamic(this, &ABountyDirector::EarnFavours); + // ActiveSideBounties[i]->CompletedSideBounty.AddDynamic(this, &ABountyDirector::EarnFavours); // ONCE AGAIN WHEN MARCEL STOPS PLAYING WITH THE CHARACTER, ADD THIS SIDE BOUNTY TO PLAYERS ARRAY OF ACTIVE BOUNTIES!!!!! } } diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h index 933c4a28..7500fc29 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h @@ -32,9 +32,6 @@ struct FMainBountyStruct UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) UTexture2D* Floorplan = nullptr; - - UPROPERTY(BlueprintReadOnly) - bool Tracked = true; }; UCLASS() diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp index bca92d12..d6227ac5 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp @@ -23,7 +23,7 @@ void ASideBountyClass::IncrementBountyCheckpoint() if (BountyCheckpoints.IsEmpty()) { - CompletedSideBounty.Broadcast(FavoursEarnedForCompletion); + CompletedSideBounty.Broadcast(GetUniqueID()); } } diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.h index 24187c7d..d71cafc8 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.h @@ -17,14 +17,15 @@ struct FSideBountyStruct UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) FString BountyDesc = ""; - UPROPERTY(BlueprintReadOnly) - bool Tracked = true; - UPROPERTY(BlueprintReadOnly) int SideBountyUID = 0; + + // Amount of Favours the Player will earn for Completing this Side Bounty + UPROPERTY(EditDefaultsOnly) + int FavoursEarnedForCompletion = 1; }; -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCompletedSideBounty, int, FavoursEarned); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCompletedSideBounty, int, SB_UID); UCLASS() class ENDLESSVENDETTA_API ASideBountyClass : public ABountyClass @@ -32,9 +33,7 @@ class ENDLESSVENDETTA_API ASideBountyClass : public ABountyClass GENERATED_BODY() // ------------------- ATTRIBUTES ------------------------------ - // Amount of Favours the Player will earn for Completing this Side Bounty - UPROPERTY(EditDefaultsOnly, Category = "Side Bounty") - int FavoursEarnedForCompletion = 1; + protected: @@ -47,7 +46,6 @@ public: FSideBountyStruct SideBountyStruct; // ------------------- METHODS --------------------------------- - private: virtual void BeginPlay() override; @@ -66,6 +64,6 @@ public: void DestroyCheckpoints(); int GetRewardInFavours() { - return FavoursEarnedForCompletion; + return 0; } }; diff --git a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp index fcb5d58a..9e97f363 100644 --- a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp @@ -34,6 +34,7 @@ void ABountyHunterCharacter::SpawnMainBounty(UEVGameInstance* GI) for (auto SideBounty : CurrentSideBounties) { SideBountyStructs.Add(SideBounty->SideBountyStruct); + SideBounty->CompletedSideBounty.AddDynamic(this, &CompletedASideBounty); } } @@ -42,16 +43,22 @@ void ABountyHunterCharacter::CompleteCurrentMainBounty(UEVGameInstance* GI) // Collect rewards for bounty and move onto next UE_LOG(LogTemp, Warning, TEXT("Would be collecting reward for completing bounty %d"), CurrentMainBountyIndex); - // FTransform PostBountySpawnTransform = MainBountyClasses[CurrentMainBountyIndex]->GetDefaultObject()->GetPlayerSpawnTransform(); - // SetActorTransform(PostBountySpawnTransform); - // Cast(GetController())->SetControlRotation(PostBountySpawnTransform.GetRotation().Rotator()); - + // Saves players spawn now as players location is set after spawn main bounty finishes running in begin play GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave = MainBountyClasses[CurrentMainBountyIndex]->GetDefaultObject()->GetPlayerSpawnTransform(); CurrentMainBountyIndex = GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave; GI->MainSaveGameInstanceRef->LastMainBountyIndexInOpenWorld = CurrentMainBountyIndex; UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0); } +void ABountyHunterCharacter::CompletedASideBounty(int CompletedSideBountiesUID) +{ + for (auto SBStruct : SideBountyStructs) + { + if (SBStruct.SideBountyUID != CompletedSideBountiesUID) continue; + //Continue writing code here about gaining money and favours + } +} + void ABountyHunterCharacter::AllBountiesCompleted() { UE_LOG(LogTemp, Warning, TEXT("Game Completed!!!! No more Bounties left... or you forgot to set a bounty at one of the indexes oof")); diff --git a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h index 8f4d0797..f9092fd1 100644 --- a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h @@ -31,11 +31,11 @@ class ENDLESSVENDETTA_API ABountyHunterCharacter : public AEndlessVendettaCharac UPROPERTY() AMainBountyClass* CurrentMainBounty; - UPROPERTY() - TArray CurrentSideBounties; - // Index of Currently Active Main Bounty, Used for MainBountyClasses int CurrentMainBountyIndex = 0; + + // References to Currently Active Side Bounties + TArray CurrentSideBounties; // Name of open world, so that the correct bounties can be spawned based on level UPROPERTY(EditDefaultsOnly, Category = "Bounty Hunter") @@ -53,6 +53,10 @@ private: // Collects Reward for Current Main Bounty and Increments the Main Bounty Index void CompleteCurrentMainBounty(UEVGameInstance* GI); + // Collects Reward for Completing a Side Bounty + UFUNCTION() + void CompletedASideBounty(int CompletedSideBountiesUID); + // Replaces Normal Bounty Info UI with Unique Game Over UI void AllBountiesCompleted();