Clean up spawn points, add mountain
This commit is contained in:
@@ -31,12 +31,18 @@ namespace Scampz.GameJam.Assets.Scripts
|
||||
for (var i = 0; i < sceneCount; ++i)
|
||||
scenes.Add(SceneManager.GetSceneAt(i));
|
||||
|
||||
if (scenes.Any(x => x.name.Contains("Temple")))
|
||||
audioSource.clip = backgroundMusic[0];
|
||||
if (scenes.Any(x => x.name.Contains("Sanctum")))
|
||||
audioSource.clip = backgroundMusic[1];
|
||||
AudioClip audioClipToPlay = null;
|
||||
|
||||
audioSource.Play();
|
||||
if (scenes.Any(x => x.name.Contains("Temple")))
|
||||
audioClipToPlay = backgroundMusic[0];
|
||||
if (scenes.Any(x => x.name.Contains("Sanctum")))
|
||||
audioClipToPlay = backgroundMusic[1];
|
||||
|
||||
if (audioClipToPlay != audioSource.clip)
|
||||
{
|
||||
audioSource.clip = audioClipToPlay;
|
||||
audioSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections;
|
||||
using Scampz.GameJam.Assets.Scripts;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
@@ -17,6 +18,16 @@ namespace Scampz.GameJam
|
||||
}
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
}
|
||||
|
||||
public void LoadScene(string sceneName, LoadSceneMode loadSceneMode)
|
||||
{
|
||||
StartCoroutine(LoadSceneAsync(sceneName, loadSceneMode));
|
||||
@@ -49,5 +60,10 @@ namespace Scampz.GameJam
|
||||
if (SceneManager.GetSceneByName(sceneName).IsValid())
|
||||
SceneManager.UnloadSceneAsync(sceneName);
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
|
||||
{
|
||||
BGMManager.Instance.PlaySong();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user