2022-05-23 18:41:30 +00:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "Engine/EngineTypes.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "GameFramework/PlayerStart.h"
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "GameplayTagContainer.h"
|
|
|
|
#include "UObject/ObjectPtr.h"
|
|
|
|
#include "UObject/UObjectGlobals.h"
|
|
|
|
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "LyraPlayerStart.generated.h"
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
class AController;
|
|
|
|
class UObject;
|
|
|
|
|
2022-05-23 18:41:30 +00:00
|
|
|
enum class ELyraPlayerStartLocationOccupancy
|
|
|
|
{
|
|
|
|
Empty,
|
|
|
|
Partial,
|
|
|
|
Full
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ALyraPlayerStart
|
|
|
|
*
|
|
|
|
* Base player starts that can be used by a lot of modes.
|
|
|
|
*/
|
|
|
|
UCLASS(Config = Game)
|
|
|
|
class LYRAGAME_API ALyraPlayerStart : public APlayerStart
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
ALyraPlayerStart(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
|
|
|
|
|
|
|
|
const FGameplayTagContainer& GetGameplayTags() { return StartPointTags; }
|
|
|
|
|
|
|
|
ELyraPlayerStartLocationOccupancy GetLocationOccupancy(AController* const ControllerPawnToFit) const;
|
|
|
|
|
|
|
|
/** Did this player start get claimed by a controller already? */
|
|
|
|
bool IsClaimed() const;
|
|
|
|
|
|
|
|
/** If this PlayerStart was not claimed, claim it for ClaimingController */
|
|
|
|
bool TryClaim(AController* OccupyingController);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/** Check if this PlayerStart is still claimed */
|
|
|
|
void CheckUnclaimed();
|
|
|
|
|
|
|
|
/** The controller that claimed this PlayerStart */
|
|
|
|
UPROPERTY(Transient)
|
|
|
|
TObjectPtr<AController> ClaimingController = nullptr;
|
|
|
|
|
|
|
|
/** Interval in which we'll check if this player start is not colliding with anyone anymore */
|
|
|
|
UPROPERTY(EditDefaultsOnly, Category = "Player Start Claiming")
|
|
|
|
float ExpirationCheckInterval = 1.f;
|
|
|
|
|
|
|
|
/** Tags to identify this player start */
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
FGameplayTagContainer StartPointTags;
|
|
|
|
|
|
|
|
/** Handle to track expiration recurring timer */
|
|
|
|
FTimerHandle ExpirationTimerHandle;
|
|
|
|
};
|