52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Cysharp.Threading.Tasks;
|
|
using Framework;
|
|
using Gameplay.SubSystems;
|
|
using PhxhSDK;
|
|
|
|
namespace Gameplay.Level
|
|
{
|
|
public partial class LevelManager : Singlenton<LevelManager>, IUpdatable, IInitable
|
|
{
|
|
public Level CurrentLevel { get; private set; }
|
|
|
|
public async UniTask<E_LoadingResult> LoadLevel(int leveId)
|
|
{
|
|
CurrentLevel = new Level(leveId, _levelParam);
|
|
AudioManager.Instance.SetGlobalListenerFollow(true);
|
|
await CurrentLevel.Load();
|
|
await UniTask.NextFrame();
|
|
|
|
return E_LoadingResult.Success;
|
|
}
|
|
|
|
public async UniTask UnloadLevel()
|
|
{
|
|
AudioManager.Instance.SetGlobalListenerFollow(false);
|
|
AudioManager.Instance.ReleaseAllAudios();
|
|
await CurrentLevel.Unload();
|
|
CurrentLevel = null;
|
|
}
|
|
|
|
public void Update(float deltaTime)
|
|
{
|
|
if (CurrentLevel != null)
|
|
{
|
|
CurrentLevel.Update(deltaTime);
|
|
}
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
InitData();
|
|
InitAction();
|
|
}
|
|
|
|
public void Release()
|
|
{
|
|
ReleaseData();
|
|
ReleaseAction();
|
|
}
|
|
}
|
|
} |