Updated Waypoints to Display Bounty Titles Instead of Checkpoint Descriptions
This commit is contained in:
parent
cc68442e46
commit
39ed880d6b
Binary file not shown.
@ -48,7 +48,7 @@ void ABountyClass::SpawnCheckpoints()
|
|||||||
|
|
||||||
// Activate the first checkpoint and listen for its completion
|
// Activate the first checkpoint and listen for its completion
|
||||||
BountyCheckpoints[0]->Active = true;
|
BountyCheckpoints[0]->Active = true;
|
||||||
BountyCheckpoints[0]->SpawnWaypoint();
|
BountyCheckpoints[0]->SpawnWaypoint(BountyTitle);
|
||||||
BountyCheckpoints[0]->CheckpointActivated();
|
BountyCheckpoints[0]->CheckpointActivated();
|
||||||
BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint);
|
BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint);
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ void ABountyClass::IncrementBountyCheckpoint()
|
|||||||
|
|
||||||
// Set the new checkpoint in pos 0 to be active and listen for it's completion
|
// Set the new checkpoint in pos 0 to be active and listen for it's completion
|
||||||
BountyCheckpoints[0]->Active = true;
|
BountyCheckpoints[0]->Active = true;
|
||||||
BountyCheckpoints[0]->SpawnWaypoint();
|
BountyCheckpoints[0]->SpawnWaypoint(BountyTitle);
|
||||||
BountyCheckpoints[0]->CheckpointActivated();
|
BountyCheckpoints[0]->CheckpointActivated();
|
||||||
BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint);
|
BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint);
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ ACheckpointClass::ACheckpointClass()
|
|||||||
{
|
{
|
||||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||||
PrimaryActorTick.bCanEverTick = true;
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
|
BountyTitle = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,23 +18,24 @@ void ACheckpointClass::BeginPlay()
|
|||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACheckpointClass::SpawnWaypoint()
|
void ACheckpointClass::SpawnWaypoint(const FString& CurrentBountyTitle)
|
||||||
{
|
{
|
||||||
if (!IsValid(WaypointActorClass)) return;
|
if (!IsValid(WaypointActorClass)) return;
|
||||||
|
|
||||||
|
BountyTitle = CurrentBountyTitle;
|
||||||
FActorSpawnParameters SpawnParams;
|
FActorSpawnParameters SpawnParams;
|
||||||
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
WaypointActor = Cast<AWaypointActor>(GetWorld()->SpawnActor<AActor>(WaypointActorClass, WaypointLoc, GetActorRotation(), SpawnParams));
|
WaypointActor = Cast<AWaypointActor>(GetWorld()->SpawnActor<AActor>(WaypointActorClass, WaypointLoc, GetActorRotation(), SpawnParams));
|
||||||
WaypointActor->SetupWaypoint(WaypointIcon, CheckpointDescription);
|
WaypointActor->SetupWaypoint(WaypointIcon, BountyTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACheckpointClass::UpdateChecpointWaypoint(FString WaypointDesc, FVector WaypointNewLoc)
|
void ACheckpointClass::UpdateChecpointWaypoint(FVector WaypointNewLoc)
|
||||||
{
|
{
|
||||||
FActorSpawnParameters SpawnParams;
|
FActorSpawnParameters SpawnParams;
|
||||||
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
if (WaypointActor) WaypointActor->Destroy();
|
if (WaypointActor) WaypointActor->Destroy();
|
||||||
WaypointActor = Cast<AWaypointActor>(GetWorld()->SpawnActor<AActor>(WaypointActorClass, WaypointNewLoc, GetActorRotation(), SpawnParams));
|
WaypointActor = Cast<AWaypointActor>(GetWorld()->SpawnActor<AActor>(WaypointActorClass, WaypointNewLoc, GetActorRotation(), SpawnParams));
|
||||||
WaypointActor->SetupWaypoint(WaypointIcon, WaypointDesc);
|
WaypointActor->SetupWaypoint(WaypointIcon, BountyTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called every frame
|
// Called every frame
|
||||||
|
@ -16,6 +16,8 @@ class ENDLESSVENDETTA_API ACheckpointClass : public AActor
|
|||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
FString BountyTitle;
|
||||||
|
|
||||||
// ------ Properties set from Editor ------
|
// ------ Properties set from Editor ------
|
||||||
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
|
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
|
||||||
FString CheckpointDescription;
|
FString CheckpointDescription;
|
||||||
@ -41,7 +43,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void UpdateChecpointWaypoint(FString WaypointDesc, FVector WaypointNewLoc);
|
void UpdateChecpointWaypoint(FVector WaypointNewLoc);
|
||||||
// Called when the game starts or when spawned
|
// Called when the game starts or when spawned
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
@ -53,7 +55,7 @@ public:
|
|||||||
UPROPERTY(BlueprintReadOnly, Category = "Checkpoint")
|
UPROPERTY(BlueprintReadOnly, Category = "Checkpoint")
|
||||||
bool Active = false;
|
bool Active = false;
|
||||||
|
|
||||||
void SpawnWaypoint();
|
void SpawnWaypoint(const FString& BountyTitle);
|
||||||
|
|
||||||
UFUNCTION(BlueprintImplementableEvent)
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
void CheckpointActivated();
|
void CheckpointActivated();
|
||||||
|
Loading…
Reference in New Issue
Block a user