Reworked Open World Checkpoint System to Allow Multiple Checkpoints
This commit is contained in:
		
							parent
							
								
									530c9580ff
								
							
						
					
					
						commit
						fbff6fdd62
					
				
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ApartmentBounty/Checkpoints/CP_ElimTImothyHuntsmer.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ApartmentBounty/Checkpoints/CP_ElimTImothyHuntsmer.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ApartmentBounty/Checkpoints/LevelSpecificCheckpoints/CP_ElimTImothyHuntsmer.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ApartmentBounty/Checkpoints/LevelSpecificCheckpoints/CP_ElimTImothyHuntsmer.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ApartmentBounty/Checkpoints/OWCP_Apartment.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ApartmentBounty/Checkpoints/OWCP_Apartment.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					version https://git-lfs.github.com/spec/v1
 | 
				
			||||||
 | 
					oid sha256:d96dde71ce13d7ed2661e3fe8d0531e67453e81644492f026f7577c12af0acf9
 | 
				
			||||||
 | 
					size 35286
 | 
				
			||||||
@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					version https://git-lfs.github.com/spec/v1
 | 
				
			||||||
 | 
					oid sha256:a6edb31abcafeab6442cb285181905031da2635eb7c6444b529d9c8636ee9496
 | 
				
			||||||
 | 
					size 29747
 | 
				
			||||||
@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					version https://git-lfs.github.com/spec/v1
 | 
				
			||||||
 | 
					oid sha256:7367fb8f5ccaf3e4ae6e34133debe0d5efbaedf33024d14cf37b1f4f5ff7fb1c
 | 
				
			||||||
 | 
					size 39283
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ApartmentBounty/MB_Apartment.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ApartmentBounty/MB_Apartment.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ControlsTutorial/Bounty/MB_Training.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ControlsTutorial/Bounty/MB_Training.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ControlsTutorial/Bounty/OWCP_Training.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/BountySystem/ControlsTutorial/Bounty/OWCP_Training.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							@ -33,6 +33,7 @@ protected:
 | 
				
			|||||||
public:
 | 
					public:
 | 
				
			||||||
	FCompletedACheckpoint CompletedACheckpoint;
 | 
						FCompletedACheckpoint CompletedACheckpoint;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Used to update Displayed Tip
 | 
				
			||||||
	FCheckpointActivated CheckpointActivated;
 | 
						FCheckpointActivated CheckpointActivated;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Gets the Reward Money for Completing this Bounty, used by Players Character
 | 
						// Gets the Reward Money for Completing this Bounty, used by Players Character
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					// Fill out your copyright notice in the Description page of Project Settings.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "OpenWorldCheckpoint.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					// Fill out your copyright notice in the Description page of Project Settings.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "CoreMinimal.h"
 | 
				
			||||||
 | 
					#include "EndlessVendetta/BountySystem/CheckpointClass.h"
 | 
				
			||||||
 | 
					#include "OpenWorldCheckpoint.generated.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					UCLASS()
 | 
				
			||||||
 | 
					class ENDLESSVENDETTA_API AOpenWorldCheckpoint : public ACheckpointClass
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						GENERATED_BODY()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
						UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
 | 
				
			||||||
 | 
						FTransform RespawnTransform;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					// Fill out your copyright notice in the Description page of Project Settings.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "OpenWorldInteractableCheckpoint.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOpenWorldInteractableCheckpoint::Interact()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						PlayerInteracted();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					// Fill out your copyright notice in the Description page of Project Settings.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "CoreMinimal.h"
 | 
				
			||||||
 | 
					#include "OpenWorldCheckpoint.h"
 | 
				
			||||||
 | 
					#include "OpenWorldInteractableCheckpoint.generated.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					UCLASS()
 | 
				
			||||||
 | 
					class ENDLESSVENDETTA_API AOpenWorldInteractableCheckpoint : public AOpenWorldCheckpoint, public IInteractionInterface
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						GENERATED_BODY()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void Interact() override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
						UFUNCTION(BlueprintImplementableEvent)
 | 
				
			||||||
 | 
						void PlayerInteracted();
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@ -15,7 +15,7 @@ void AMainBountyClass::IncrementBountyCheckpoint()
 | 
				
			|||||||
void AMainBountyClass::ActivateFirstCheckpoint()
 | 
					void AMainBountyClass::ActivateFirstCheckpoint()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Super::ActivateFirstCheckpoint();
 | 
						Super::ActivateFirstCheckpoint();
 | 
				
			||||||
	if (IsValid(OpenWorldcheckpoint)) OpenWorldcheckpoint->SpawnWaypoint(MainBountyStruct.TargetName);
 | 
						//if (IsValid(OpenWorldcheckpoint)) OpenWorldcheckpoint->SpawnWaypoint(MainBountyStruct.TargetName);
 | 
				
			||||||
	if (BountyCheckpoints.IsEmpty() || BountyCheckpoints[0] == nullptr) return;
 | 
						if (BountyCheckpoints.IsEmpty() || BountyCheckpoints[0] == nullptr) return;
 | 
				
			||||||
	BountyCheckpoints[0]->SpawnWaypoint(MainBountyStruct.TargetName);
 | 
						BountyCheckpoints[0]->SpawnWaypoint(MainBountyStruct.TargetName);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -23,19 +23,22 @@ void AMainBountyClass::ActivateFirstCheckpoint()
 | 
				
			|||||||
void AMainBountyClass::DeActivateFirstCheckpoint()
 | 
					void AMainBountyClass::DeActivateFirstCheckpoint()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Super::DeActivateFirstCheckpoint();
 | 
						Super::DeActivateFirstCheckpoint();
 | 
				
			||||||
	if (IsValid(OpenWorldcheckpoint)) OpenWorldcheckpoint->DestroyWaypoint();
 | 
						//if (IsValid(OpenWorldcheckpoint)) OpenWorldcheckpoint->DestroyWaypoint();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void AMainBountyClass::SpawnOpenWorldCheckpoint()
 | 
					void AMainBountyClass::SpawnOpenWorldCheckpoint()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!IsValid(OpenWorldCheckpointClass)) return;
 | 
						if (OpenWorldCheckpointClasses.IsEmpty()) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FActorSpawnParameters SpawnParameters;
 | 
						for (TSubclassOf<ACheckpointClass> OpenWorldCheckpointClass : OpenWorldCheckpointClasses)
 | 
				
			||||||
	SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
 | 
						{
 | 
				
			||||||
	FVector Loc = OpenWorldCheckpointClass.GetDefaultObject()->GetCheckpointSpawnTransform().GetLocation();
 | 
							if (OpenWorldCheckpointClass == nullptr) continue;
 | 
				
			||||||
	FRotator Rot = OpenWorldCheckpointClass.GetDefaultObject()->GetCheckpointSpawnTransform().GetRotation().Rotator();
 | 
							FActorSpawnParameters SpawnParameters;
 | 
				
			||||||
	
 | 
							SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
 | 
				
			||||||
	OpenWorldcheckpoint = GetWorld()->SpawnActor<ACheckpointClass>(OpenWorldCheckpointClass, Loc, Rot, SpawnParameters);
 | 
							FVector Loc = OpenWorldCheckpointClass.GetDefaultObject()->GetCheckpointSpawnTransform().GetLocation();
 | 
				
			||||||
 | 
					        FRotator Rot = OpenWorldCheckpointClass.GetDefaultObject()->GetCheckpointSpawnTransform().GetRotation().Rotator();
 | 
				
			||||||
 | 
							BountyCheckpoints.Add(GetWorld()->SpawnActor<ACheckpointClass>(OpenWorldCheckpointClass, Loc, Rot, SpawnParameters));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	ActivateFirstCheckpoint();
 | 
						ActivateFirstCheckpoint();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -42,10 +42,10 @@ class ENDLESSVENDETTA_API AMainBountyClass : public ABountyClass
 | 
				
			|||||||
// ------------------- ATTRIBUTES ------------------------------
 | 
					// ------------------- ATTRIBUTES ------------------------------
 | 
				
			||||||
	// Used to Spawn Open World Checkpoint for this Main Bounty
 | 
						// Used to Spawn Open World Checkpoint for this Main Bounty
 | 
				
			||||||
	UPROPERTY(EditDefaultsOnly, Category = "Bounty")
 | 
						UPROPERTY(EditDefaultsOnly, Category = "Bounty")
 | 
				
			||||||
	TSubclassOf<ACheckpointClass> OpenWorldCheckpointClass;
 | 
						TArray<TSubclassOf<ACheckpointClass>> OpenWorldCheckpointClasses;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Used to Store Ref for Bounty Tracking Functionality
 | 
						// Used to Store Ref for Bounty Tracking Functionality
 | 
				
			||||||
	ACheckpointClass* OpenWorldcheckpoint;
 | 
						//TArray<ACheckpointClass*> OpenWorldcheckpoints;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Used by Players Character to Determine where to Spawn in the Open World after Completing Main Bounty
 | 
						// Used by Players Character to Determine where to Spawn in the Open World after Completing Main Bounty
 | 
				
			||||||
	UPROPERTY(EditDefaultsOnly, Category = "Bounty")
 | 
						UPROPERTY(EditDefaultsOnly, Category = "Bounty")
 | 
				
			||||||
@ -95,10 +95,10 @@ public:
 | 
				
			|||||||
	void DeActivateFirstCheckpoint() override;
 | 
						void DeActivateFirstCheckpoint() override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Returns open world checkpoints tip
 | 
						// Returns open world checkpoints tip
 | 
				
			||||||
	FString GetOpenWorldCheckpointTip()
 | 
						// FString GetOpenWorldCheckpointTip()
 | 
				
			||||||
	{
 | 
						// {
 | 
				
			||||||
		return OpenWorldcheckpoint->GetCheckpointTip();
 | 
						// 	return OpenWorldcheckpoint->GetCheckpointTip();
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
				
			|||||||
@ -60,7 +60,6 @@ void ABountyHunterCharacter::CompleteCurrentMainBounty(UEVGameInstance* GI)
 | 
				
			|||||||
	EarnMoney(MoneyEarned);
 | 
						EarnMoney(MoneyEarned);
 | 
				
			||||||
	BountyCompletedDisplay(MoneyEarned, 0);
 | 
						BountyCompletedDisplay(MoneyEarned, 0);
 | 
				
			||||||
	if (IsValid(PauseMenu)) PauseMenu->UpdatePlayerStatistics(Money, Favours);
 | 
						if (IsValid(PauseMenu)) PauseMenu->UpdatePlayerStatistics(Money, Favours);
 | 
				
			||||||
	UE_LOG(LogTemp, Warning, TEXT("Would be collecting reward for completing bounty %d"), CurrentMainBountyIndex);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Saves players spawn now as players location is set after spawn main bounty finishes running in begin play
 | 
						// Saves players spawn now as players location is set after spawn main bounty finishes running in begin play
 | 
				
			||||||
	GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave = MainBountyClasses[CurrentMainBountyIndex]->GetDefaultObject<AMainBountyClass>()->GetPlayerSpawnTransform();
 | 
						GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave = MainBountyClasses[CurrentMainBountyIndex]->GetDefaultObject<AMainBountyClass>()->GetPlayerSpawnTransform();
 | 
				
			||||||
 | 
				
			|||||||
@ -285,7 +285,7 @@ private:
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		DeActivateAllBounties();
 | 
							DeActivateAllBounties();
 | 
				
			||||||
		CurrentMainBounty->ActivateFirstCheckpoint();
 | 
							CurrentMainBounty->ActivateFirstCheckpoint();
 | 
				
			||||||
		DisplayCheckpointTip(CurrentMainBounty->GetOpenWorldCheckpointTip());
 | 
							//DisplayCheckpointTip(CurrentMainBounty->GetOpenWorldCheckpointTip());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	UFUNCTION()
 | 
						UFUNCTION()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user