Fixed Waypoint Appearing for Inactive Checkpoints

This commit is contained in:
Rafal Swierczek 2023-10-20 14:42:12 +01:00
parent 97ac729dd5
commit bae8955a27
3 changed files with 9 additions and 1 deletions

View File

@ -48,6 +48,7 @@ void ABountyClass::SpawnCheckpoints()
// Activate the first checkpoint and listen for its completion
BountyCheckpoints[0]->Active = true;
BountyCheckpoints[0]->SpawnWaypoint();
BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint);
}
@ -84,6 +85,7 @@ void ABountyClass::IncrementBountyCheckpoint()
// Set the new checkpoint in pos 0 to be active and listen for it's completion
BountyCheckpoints[0]->Active = true;
BountyCheckpoints[0]->SpawnWaypoint();
BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint);
}

View File

@ -15,6 +15,10 @@ ACheckpointClass::ACheckpointClass()
void ACheckpointClass::BeginPlay()
{
Super::BeginPlay();
}
void ACheckpointClass::SpawnWaypoint()
{
if (!IsValid(WaypointActorClass)) return;
FActorSpawnParameters SpawnParams;

View File

@ -48,6 +48,8 @@ public:
UPROPERTY(BlueprintReadOnly, Category = "Checkpoint")
bool Active = false;
void SpawnWaypoint();
// ------ Getters for CP Properties ------
FString GetCheckpointDesc()
{