// Project Lab - NHTV Igad

#pragma once

#include "Abilities/AbilityTriggerBase.h"
#include "TrailTrigger.generated.h"

/**
 * 
 */
UCLASS()
class UNREALPROJECT_API ATrailTrigger : public AAbilityTriggerBase
{
	GENERATED_BODY()
public:
	virtual void BeginPlay() override;

	ATrailTrigger();
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Trigger", meta = (ClampMin = "0", UIMin = "0"))
		float totalSpawnTime = 1.5f;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Trigger", meta = (ClampMin = "0", UIMin = "0"))
	float lifeTime = 5.0f;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Trigger", meta = (ClampMin = "0", UIMin = "0"))
	float colliderSpawnDistance = 50.0f;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Trigger", meta = (ClampMin = "0", UIMin = "0"))
	float colliderRadius = 50.0f;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Trigger", meta = (ClampMin = "0", UIMin = "0"))
	TSubclassOf<class AEffect> trailEffectClass;
	
	
	virtual void Tick(float DeltaSeconds) override;

private:
	void SpawnTrail(FVector offset, bool first = false);
	float m_tickTimer = 0.0f;
	FVector m_lastPos;
	float m_totalTimer = 0.0f;
};
