79 lines
1.8 KiB
C++
79 lines
1.8 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "WaypointActor.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "CheckpointClass.generated.h"
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedCheckpoint);
|
|
|
|
UCLASS()
|
|
class ENDLESSVENDETTA_API ACheckpointClass : public AActor
|
|
{
|
|
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;
|
|
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
|
|
TSubclassOf<AWaypointActor> WaypointActorClass;
|
|
|
|
AWaypointActor* WaypointActor;
|
|
// ----------------------------------------
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Checkpoint")
|
|
void BroadcastCompletion()
|
|
{
|
|
UE_LOG(LogTemp, Warning, TEXT("Completed Checkpoint"));
|
|
CompletedCheckpoint.Broadcast();
|
|
}
|
|
|
|
protected:
|
|
// Called when the game starts or when spawned
|
|
virtual void BeginPlay() override;
|
|
|
|
virtual void Destroyed() 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;
|
|
|
|
|
|
|
|
};
|