// Project Lab - NHTV Igad

#pragma once

#include "GameFramework/Actor.h"
#include "MusicPlayer.generated.h"

UCLASS()
class UNREALPROJECT_API AMusicPlayer : public AActor
{
	GENERATED_BODY()
	
public:	
	AMusicPlayer();

	virtual void BeginPlay() override;
	
	virtual void Tick( float DeltaSeconds ) override;

	UPROPERTY(EditAnywhere)
	TArray<class USoundBase*> generalMusic;
	UPROPERTY(EditAnywhere)
	TArray<class USoundBase*> combatMusic;

	void SetInCombat(bool inCombat);

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
	class UAudioComponent* audioComponent;

private:
	int32 m_currentTrack;
	TArray<int32> m_lastTracks;

	UPROPERTY(Replicated)
	bool m_setInCombat;

	bool m_isInCombat;
	float m_changeTime;

	void m_SelectNextTrack();
};
