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

#pragma once

#include "CoreMinimal.h"
#include "Camera/CameraComponent.h"
#include "EndlessVendetta/UserWidgets/MiniWaypoint.h"
#include "GameFramework/Actor.h"
#include "WaypointActor.generated.h"

UCLASS()
class ENDLESSVENDETTA_API AWaypointActor : public AActor
{
	GENERATED_BODY()

	UCameraComponent* PlayersCam;
	
	float ScalingMagnitude;

	float ScalingY_Intercept;

	UPROPERTY(EditDefaultsOnly, Category = "Waypoint")
	float WaypointFocusDistance = 3000;

	UPROPERTY(EditDefaultsOnly, Category = "Waypoint")
	TSubclassOf<UMiniWaypoint> MiniWaypointClass;

	UMiniWaypoint* MiniWaypoint;

	UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling")
	float MaxDist = 16000.f;

	UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling")
	float ScaleAtMaxDist = 4.f;

	UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling")
	float MinDist = 900.f;

	UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling")
	float ScaleAtMinDist = 0.15;

	void UpdateScaleAndRotation();

	bool SightCheck();
	
protected:
	UFUNCTION(BlueprintImplementableEvent)
	void UpdateVisibility(bool IsVisible);

	void Destroyed() override;

public:
	// Sets default values for this actor's properties
    AWaypointActor();
	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	UFUNCTION(BlueprintNativeEvent)
	void SetupWaypoint(UTexture2D* Icon, const FString& Desc);

};
