// Oleg Petruny proprietary.

#pragma once

#include "Engine/LevelScriptActor.h"

#include "LevelBase.generated.h"

UCLASS(BlueprintType)
class ALevelBase : public ALevelScriptActor
{
    GENERATED_BODY()

public:
    UFUNCTION(BlueprintCallable)
    inline void CallNextState() { ++state; NextState(); }

    UFUNCTION(BlueprintImplementableEvent)
    void CallEvent(int32 id);

    inline int32 GetState() { return state; };

protected:
    virtual void BeginPlay() override;

    UFUNCTION(BlueprintImplementableEvent)
    void NextState();

    UFUNCTION(BlueprintCallable)
    void IterateToState(int32 to);

    void BroadcastNewLevelBeginPlay();
    void StartLevelAnimations();
    void ApplySaveData();

    UPROPERTY(EditDefaultsOnly)
    TArray<TSoftObjectPtr<class ULevelSequence>> onBeginPlaySequences;
    TArray<class ALevelSequenceActor*> onBeginPlaySequencesActors;

    UPROPERTY(BlueprintReadOnly)
    int32 state = -1;
    UPROPERTY(EditDefaultsOnly)
    TArray<TSoftObjectPtr<class ULevelSequence>> stateSequences;
};
