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 "CheckpointClass.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedCheckpoint);
UCLASS()
class ENDLESSVENDETTA_API ACheckpointClass : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ACheckpointClass();
// ------ 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;
// ----------------------------------------
UFUNCTION(BlueprintCallable, Category = "Checkpoint")
void BroadcastCompletion()
{
CompletedCheckpoint.Broadcast();
}
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
FCompletedCheckpoint CompletedCheckpoint;
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
virtual void Tick(float DeltaTime) override;
};