// Oleg Petruny proprietary.

#pragma once

#include "Minigame/Minigame.h"

#include "SubwaySurfManager.generated.h"

struct ObstacleData
{
    class ASubwaySurfObstacle* actor;
    int32 lineId;
    float time;
};

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

public:
    ASubwaySurfManager();

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

    void Hit();
    void Finish();

protected:
    virtual void PostInitializeComponents() override;
    virtual void Tick(float deltaTime) override;

    void CreateObstacle(int32 index = -1);

    void Up();
    void Down();
    void Left();
    void Right();

    UPROPERTY(EditDefaultsOnly)
    TSet<TSubclassOf<class ASubwaySurfObstacle>> obstacleClasses;

    UPROPERTY(EditAnywhere)
    class UCameraComponent* camera;

    UPROPERTY(EditAnywhere)
    class USkeletalMeshComponent* mannequin;

    UPROPERTY(EditDefaultsOnly)
    float speed = 2;

    UPROPERTY(EditDefaultsOnly)
    float spawnDelay = 3;
    float time = spawnDelay;

    UPROPERTY(EditDefaultsOnly)
    TArray<class USplineComponent*> lines;

    TArray<ObstacleData> obstacles;
    int32 lastSpawnedLine = -1;
    TArray<int32> inputHandlers;
    class USceneComponent* playerPos;
    int32 vertical = 1;
    int32 horizontal = 1;
};
