- Fix lighting on desert - Move dialogue radius to correct spot - Disable movement while talking to NPCs - Move desert spawn point a little bit
52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using System.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace Scampz.GameJam
|
|
{
|
|
public class GameManager : MonoBehaviour
|
|
{
|
|
public static GameManager Instance;
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance != null && Instance != this)
|
|
{
|
|
DestroyImmediate(this);
|
|
return;
|
|
}
|
|
Instance = this;
|
|
}
|
|
|
|
|
|
public void LoadScene(string sceneName, LoadSceneMode loadSceneMode)
|
|
{
|
|
StartCoroutine(LoadSceneAsync(sceneName, loadSceneMode));
|
|
}
|
|
|
|
private IEnumerator LoadSceneAsync(string sceneName, LoadSceneMode loadSceneMode)
|
|
{
|
|
yield return null;
|
|
var player = GameObject.FindGameObjectWithTag("Player");
|
|
LevelChanger.Instance.FadeAnimation();
|
|
yield return null;
|
|
var loadSceneOperation = SceneManager.LoadSceneAsync(sceneName, loadSceneMode);
|
|
yield return new WaitForSeconds(3f);
|
|
|
|
loadSceneOperation.allowSceneActivation = false;
|
|
while (!loadSceneOperation.isDone)
|
|
{
|
|
yield return null;
|
|
if (loadSceneOperation.progress >= 0.9f)
|
|
break;
|
|
}
|
|
|
|
loadSceneOperation.allowSceneActivation = true;
|
|
yield return loadSceneOperation;
|
|
var cc = player.GetComponent<CharacterController>();
|
|
cc.enabled = false;
|
|
yield return null;
|
|
}
|
|
}
|
|
}
|