common extensions and some utilities

This commit is contained in:
2025-03-19 00:18:40 +01:00
parent f80fd22a00
commit e62bd2aa6d
35 changed files with 323 additions and 58 deletions

View File

@@ -1,21 +1,19 @@
using System.Threading;
using Cysharp.Threading.Tasks;
using RebootKit.Engine.Foundation;
using RebootKit.Engine.Services.Console;
using UnityEngine.Assertions;
namespace RebootKit.Engine.Services.Game {
public class GameService : IService {
private static readonly Logger Logger = new(nameof(GameService));
[Inject]
private DIContext _diContext;
private GameModeAsset _gameModeAsset;
private GameMode _gameMode;
private bool _running;
public async UniTask OnWakeUp(CancellationToken cancellationToken) {
await UniTask.Yield(cancellationToken);
}
public void Dispose() {
_running = false;
_gameMode.Dispose();
@@ -24,7 +22,7 @@ namespace RebootKit.Engine.Services.Game {
public async UniTask Start(GameModeAsset asset, CancellationToken cancellationToken) {
Assert.IsNotNull(asset);
_gameMode = asset.Create();
_gameMode = asset.Create(_diContext);
await _gameMode.Start(cancellationToken);
Run(cancellationToken).Forget();