// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "SoundManager.generated.h"

/**
* Defines the types of sounds that exist in the game.
*/
UENUM(BlueprintType)
enum class EGameSoundType : uint8
{
	Effect	UMETA(DisplayName = "Effect"),
	Music	UMETA(DisplayName = "Music")
};

/**
 * A manager used to play all sounds within the game.
 */
UCLASS()
class GAMEJAMTEMPLATE_API USoundManager : public UObject
{
	GENERATED_BODY()

public:

	USoundManager();

	/**
	* Gets the volume for the specified sound type.
	* @param SoundType The type of the sound.
	* @return The volume of the sound type.
	*/
	UFUNCTION(BlueprintCallable)
	float GetSoundVolume(EGameSoundType SoundType);

	/**
	* Sets the volume for the specified sound type.
	* @param SoundType The type of the sound.
	* @param NewVolume The new volume for the sound type.
	*/
	UFUNCTION(BlueprintCallable)
	void SetSoundVolume(EGameSoundType SoundType, float NewVolume);

	/**
	* Plays the specified sound at the specified location.
	* @param SoundType The type of the sound.
	* @param SoundCue The sound to play.
	* @param SoundLocation The world space location where to play the sound.
	*/
	UFUNCTION(BlueprintCallable)
	void PlaySound(EGameSoundType SoundType, class USoundCue* SoundCue, FVector SoundLocation);

private:

	// The name of the object fetched by the UObjectBaseUtility::GetName method
	const FString ObjectName;

	// The volume of different sound types in the game.
	TMap<EGameSoundType, float> VolumeMap;
	
};
