// Copyright (c) 2026, LuQ Studios. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "Quest/PulseQuestObjective.h"
#include "MyStandStillObjective.generated.h"

/**
 * Completes when the avatars of the quest manager stood still for Seconds seconds in a row.
 * Progress counts the full seconds, so the display text can show {Progress}/{Target}.
 */
UCLASS(Blueprintable, meta = (DisplayName = "Stand Still Objective"))
class MYGAME_API UMyStandStillObjective : public UPulseQuestObjective
{
	GENERATED_BODY()
public:

	UMyStandStillObjective(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());

	/** How long the avatars must stand still, in seconds. */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (ClampMin = "1", Units = "Seconds"), Category = "Stand Still")
	float Seconds = 5.f;

	/** Speed in cm/s below which an avatar counts as standing still. */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (ClampMin = "0", Units = "CentimetersPerSecond"), Category = "Stand Still")
	float MaxSpeed = 10.f;

protected:

	virtual EPulseObjectiveCompletionStatus InitObjective_Implementation(const FPulseObjectiveHandle& Handle, const FGameplayTag& InQuestTag) override;
	virtual void Tick(float DeltaTime) override;

private:

	/** Seconds the avatars stood still so far. SaveGame: the objective continues after loading. */
	UPROPERTY(SaveGame)
	float StillTime = 0.f;
};
