49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Cysharp.Threading.Tasks;
|
|
using Framework;
|
|
using PhxhSDK;
|
|
|
|
namespace Gameplay.Level
|
|
{
|
|
public partial class LevelManager : Singlenton<LevelManager>, IUpdatable, IInitable
|
|
{
|
|
public Level CurrentLevel { get; private set; }
|
|
|
|
public bool IsInLevel => CurrentLevel != null;
|
|
|
|
public async UniTask LoadLevel(int leveId)
|
|
{
|
|
CurrentLevel = new Level(leveId);
|
|
await CurrentLevel.Load();
|
|
await UniTask.NextFrame();
|
|
}
|
|
|
|
public void UnloadLevel()
|
|
{
|
|
CurrentLevel.Unload();
|
|
CurrentLevel.Release();
|
|
CurrentLevel = null;
|
|
}
|
|
|
|
public void Update(float deltaTime)
|
|
{
|
|
if (CurrentLevel != null)
|
|
{
|
|
CurrentLevel.Update(deltaTime);
|
|
}
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
InitData();
|
|
InitAction();
|
|
}
|
|
|
|
public void Release()
|
|
{
|
|
ReleaseData();
|
|
ReleaseAction();
|
|
}
|
|
}
|
|
} |