// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "EndlessVendetta/GadgetSystem/ReconGadget.h"
#include "VisionLink.generated.h"

/**
 * 
 */
UCLASS()
class ENDLESSVENDETTA_API AVisionLink : public AReconGadget
{
	GENERATED_BODY()

	int NumOfPingPulsesLeftInThisCycle;

	float TimeInbetweenPingPulses;

	FTimerHandle PulseHandle;

	void SendOutPingPulse();

	void TestLOS(FTransform StartingPos, TArray<AActor*> &ActorsToIgnore);

	virtual void BeginPlay() override;
	
	virtual void Activate() override;

	virtual void FinishedUsing() override;

protected:
	UPROPERTY(EditDefaultsOnly, Category = "Vision Link")
	int NumberOfPingPulses = 1;

	UPROPERTY(EditDefaultsOnly, Category = "Vision Link")
	int LT_Horizontal_Density = 80;

	UPROPERTY(EditDefaultsOnly, Category = "Vision Link")
	int LT_Vertical_Density = 25;

	UPROPERTY(EditDefaultsOnly, Category = "Vision Link")
	float LT_Distance = 4000;

	UPROPERTY(EditDefaultsOnly, Category = "Vision Link")
	float H_FOV = 75;

	UPROPERTY(EditDefaultsOnly, Category = "Vision Link")
	float V_FOV = 25;

	UPROPERTY(BlueprintReadOnly, Category = "Vision Link")
	float CooldownLength;

	UPROPERTY(BlueprintReadOnly, Category = "Vision Link")
	float InUseDuration;

	// Updates UI with time to next Pulse
	UFUNCTION(BlueprintImplementableEvent, Category = "Vision Link")
	void PlayPingPulseAnim(float PulseDuration);

	// Updates UI with pulses remaining
	UFUNCTION(BlueprintImplementableEvent, Category = "Vision Link")
	void UpdatePulsesRemaining(int PulsesRemaining);

	UFUNCTION(BlueprintImplementableEvent, Category = "Vision Link")
	void VisionLinkActivated();

	UFUNCTION(BlueprintImplementableEvent, Category = "Vision Link")
	void VisionLinkRecharging();

	UFUNCTION(BlueprintImplementableEvent, Category = "Vision Link")
	void SpawnPing(FTransform PingSpawnTransform);
};
