-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBiomeMusic.cs
More file actions
37 lines (29 loc) · 1.11 KB
/
Copy pathBiomeMusic.cs
File metadata and controls
37 lines (29 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System.Collections;
using FMOD.Studio;
using UnityEngine;
namespace FK.Tulip.Audio
{
public class BiomeMusic : MonoBehaviour
{
[Header("FMOD Events")]
[SerializeField] private FMODEvent biomeMusic;
[Header("Config")]
[SerializeField, EnumButtons] private Biome startingBiome;
private EventInstance musicInstance;
private PARAMETER_DESCRIPTION paramBiome;
private IEnumerator Start()
{
// Log.Info($"{logPrefix} waiting for banks to load...", this);
// yield return Awaitable.WaitForSecondsAsync(2f); // for testing
yield return AudioManager.WaitForAllBanksToLoad();
// Log.Info($"{logPrefix} starting BGM...", this);
biomeMusic.Describe();
biomeMusic.DescribeParameter("Biome", out paramBiome);
biomeMusic.StartNewInstance();
SetBiome(startingBiome);
}
private void SetBiome(Biome biome) =>
biomeMusic.Instance.SetParameter(paramBiome, biome);
private static readonly string logPrefix = $"[{nameof(BiomeMusic)}]";
}
}