Implemented Checkpoint Class Functionality

This commit is contained in:
Rafal Swierczek 2023-09-27 14:47:50 +01:00
parent 51cc5b8930
commit 44e0a6bc2d

View File

@ -6,21 +6,65 @@
#include "GameFramework/Actor.h" #include "GameFramework/Actor.h"
#include "CheckpointClass.generated.h" #include "CheckpointClass.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedCheckpoint);
UCLASS() UCLASS()
class ENDLESSVENDETTA_API ACheckpointClass : public AActor class ENDLESSVENDETTA_API ACheckpointClass : public AActor
{ {
GENERATED_BODY() GENERATED_BODY()
// ------ Properties set from Editor ------
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
FString CheckpointDescription;
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
FVector WaypointLoc;
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
UTexture2D* WaypointIcon;
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
FTransform CheckpointSpawnTransform;
// ----------------------------------------
public: UFUNCTION(BlueprintCallable, Category = "Checkpoint")
// Sets default values for this actor's properties void BroadcastCompletion()
ACheckpointClass(); {
CompletedCheckpoint.Broadcast();
}
protected: protected:
// Called when the game starts or when spawned // Called when the game starts or when spawned
virtual void BeginPlay() override; virtual void BeginPlay() override;
public:
FCompletedCheckpoint CompletedCheckpoint;
public: UPROPERTY(BlueprintReadOnly, Category = "Checkpoint")
bool Active = false;
// ------ Getters for CP Properties ------
FString GetCheckpointDesc()
{
return CheckpointDescription;
}
FVector GetWaypointLoc()
{
return WaypointLoc;
}
UTexture2D* GetWaypointIcon()
{
return WaypointIcon;
}
FTransform GetCheckpointSpawnTransform()
{
return CheckpointSpawnTransform;
}
// ---------------------------------------
// Sets default values for this actor's properties
ACheckpointClass();
// Called every frame // Called every frame
virtual void Tick(float DeltaTime) override; virtual void Tick(float DeltaTime) override;
}; };