// Oleg Petruny proprietary.

#pragma once

#include "Minigame/Minigame.h"

#include "AgeOfWarManager.generated.h"

UCLASS(Blueprintable, BlueprintType, MinimalAPI)
class AAgeOfWarManager : public AMinigame
{
    GENERATED_BODY()

public:
    static const struct FAgeOfWarUnitStats& UnitGetStats(TSubclassOf<AAgeOfWarUnit> unitClass);

    AAgeOfWarManager();

    virtual void Start(class APlayerBase* playerPawn, FMinigameEndCallback delegate) override;
    virtual void End() override;

    void UnitKill(class AAgeOfWarUnit* unit);
    UFUNCTION(BlueprintImplementableEvent)
    void OnUnitKill(class AAgeOfWarUnit* unit);

protected:
    UFUNCTION(BlueprintImplementableEvent)
    void FillUnitStats();
    UFUNCTION(BlueprintCallable)
    static void AddUnitStats(TSubclassOf<AAgeOfWarUnit> unitClass, struct FAgeOfWarUnitStats stats);
    UFUNCTION(BlueprintPure)
    static struct FAgeOfWarUnitStats GetUnitStats(TSubclassOf<AAgeOfWarUnit> unitClass);

    UFUNCTION(BlueprintCallable)
    void SpawnUnit(TSubclassOf<AAgeOfWarUnit> unitClass, FTransform transform, bool computer = false);

    static TMap<UClass*, struct FAgeOfWarUnitStats> unitStats;

    UPROPERTY(EditAnywhere)
    class UCameraComponent* camera;

    TSet<AAgeOfWarUnit*> spawnedUnits;
};
