This repository has been archived on 2026-07-13. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
servicepoint-tanks/TanksServer/GameLogic/RotateTanks.cs
Vinzenz Schroeter 461a9139c2 infinite map
2024-04-12 18:32:10 +02:00

21 lines
578 B
C#

namespace TanksServer.GameLogic;
internal sealed class RotateTanks(TankManager tanks, IOptions<TanksConfiguration> options) : ITickStep
{
private readonly TanksConfiguration _config = options.Value;
public Task TickAsync()
{
foreach (var tank in tanks)
{
var player = tank.Owner;
if (player.Controls.TurnLeft)
tank.Rotation -= _config.TurnSpeed / 16d;
if (player.Controls.TurnRight)
tank.Rotation += _config.TurnSpeed / 16d;
}
return Task.CompletedTask;
}
}