tanks can spawn and get rendered
This commit is contained in:
parent
151cad4cee
commit
a3bd582b2e
1 changed files with 283 additions and 105 deletions
|
|
@ -2,7 +2,7 @@ using Microsoft.Extensions.Hosting;
|
|||
|
||||
namespace TanksServer.Services;
|
||||
|
||||
internal sealed class GameTickService(IEnumerable<ITickStep> steps) : IHostedService
|
||||
internal sealed class GameTickService(IEnumerable<ITickStep> steps) : IHostedService, IDisposable
|
||||
{
|
||||
private readonly CancellationTokenSource _cancellation = new();
|
||||
private readonly List<ITickStep> _steps = steps.ToList();
|
||||
|
|
@ -29,6 +29,12 @@ internal sealed class GameTickService(IEnumerable<ITickStep> steps) : IHostedSer
|
|||
await _cancellation.CancelAsync();
|
||||
if (_run != null) await _run;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_cancellation.Dispose();
|
||||
_run?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public interface ITickStep
|
||||
|
|
|
|||
Reference in a new issue