#pragma once
#include "Kismet/BlueprintFunctionLibrary.h"
#include "AbilityFilter.h"
#include "BlueprintAbilityLibrary.Generated.h"

UCLASS()
class ULib : public UBlueprintFunctionLibrary
{
	GENERATED_UCLASS_BODY()

public:
	UFUNCTION(BlueprintCallable, Category = "Spawning", meta = (WorldContext = "WorldContextObject", UnsafeDuringActorConstruction = "true", BlueprintInternalUseOnly = "true"))
	static AActor* BeginSpawning2(UObject* WorldContextObject, TSubclassOf<AActor> ActorClass);
	UFUNCTION(BlueprintCallable, Category = "Spawning", meta = (UnsafeDuringActorConstruction = "true", BlueprintInternalUseOnly = "true"))
	static AActor* FinishSpawning2(class AActor* Actor);

	UFUNCTION(BlueprintCallable, Category = "Spawning", meta = (WorldContext = "WorldContextObject", UnsafeDuringActorConstruction = "true", BlueprintInternalUseOnly = "true"))
	static AActor* BeginSpawningGroup(UObject* WorldContextObject, TSubclassOf<AActor> ActorClass);
	UFUNCTION(BlueprintCallable, Category = "Spawning", meta = (UnsafeDuringActorConstruction = "true", BlueprintInternalUseOnly = "true"))
	static AActor* FinishSpawningGroup(class AActor* Actor);

	UFUNCTION(BlueprintCallable, Category = "Spawning", meta = (WorldContext = "WorldContextObject", UnsafeDuringActorConstruction = "true", BlueprintInternalUseOnly = "true"))
	static AActor* BeginSpawningModifier(UObject* WorldContextObject, TSubclassOf<AActor> ActorClass);
	UFUNCTION(BlueprintCallable, Category = "Spawning", meta = (UnsafeDuringActorConstruction = "true", BlueprintInternalUseOnly = "true"))
	static AActor* FinishSpawningModifier(class AActor* Actor, class ANetworkCharacter* Target);

	UFUNCTION(BlueprintCallable, Category = "Spawning", meta = (WorldContext = "WorldContextObject", UnsafeDuringActorConstruction = "true", BlueprintInternalUseOnly = "true"))
	static AActor* BeginSpawningTrigger(UObject* WorldContextObject, TSubclassOf<AActor> ActorClass, const FTransform& SpawnTransform);
	UFUNCTION(BlueprintCallable, Category = "Spawning", meta = (UnsafeDuringActorConstruction = "true", BlueprintInternalUseOnly = "true"))
	static AActor* FinishSpawningTrigger(class AActor* Actor, const FTransform& SpawnTransform);

	UFUNCTION(BlueprintCallable, Category = "Spawning", meta = (WorldContext = "WorldContextObject", UnsafeDuringActorConstruction = "true", BlueprintInternalUseOnly = "true"))
	static AActor* BeginSpawningProjectile(UObject* WorldContextObject, TSubclassOf<AActor> ActorClass, const FTransform& SpawnTransform);
	UFUNCTION(BlueprintCallable, Category = "Spawning", meta = (UnsafeDuringActorConstruction = "true", BlueprintInternalUseOnly = "true"))
	static AActor* FinishSpawningProjectile(class AActor* Actor, const FTransform& SpawnTransform);

	UFUNCTION(BlueprintCallable, Category = "Trigger")
	static bool IsContainedInCone(FVector origin, FVector forward, float coneAngle, AActor* other);

	DECLARE_DYNAMIC_DELEGATE_OneParam(FCharacterConeOverlapCallback, class ANetworkCharacter*, character);
	UFUNCTION(BlueprintCallable, Category = "Trigger", meta = (WorldContext = "WorldContextObject"))
		static int32 CharacterConeOverlap(UObject* WorldContextObject, FVector origin, float coneRadius,
			FCharacterConeOverlapCallback callback, FVector forward = FVector(1, 0, 0), float coneAngle = 360.0f, EAbilityFilter filter = EAbilityFilter::EnemyAll);
	UFUNCTION(BlueprintCallable, Category = "Trigger", meta = (WorldContext = "WorldContextObject"))
		static	TArray<class ANetworkCharacter*> GetCharacterOverlaps();

	DECLARE_DYNAMIC_DELEGATE_OneParam(FClosestCharacterConeOverlapCallback, class ANetworkCharacter*, character);
	UFUNCTION(BlueprintCallable, Category = "Trigger", meta = (WorldContext = "WorldContextObject"))
	static int32 ClosestCharacterConeOverlap(UObject* WorldContextObject, FVector origin, float coneRadius,
		FClosestCharacterConeOverlapCallback callback, FVector forward = FVector(1, 0, 0), float coneAngle = 360.0f, EAbilityFilter filter = EAbilityFilter::EnemyAll);

	UFUNCTION(BlueprintCallable, Category = "Damage Proxy")
	static bool CheckAbilityFilter(EAbilityFilter filter, class ANetworkCharacter* self, class ANetworkCharacter* other);

	static TArray<class ANetworkCharacter*> m_overlapResultArray;
	
private:
	
};