server-master/srcs/WingsAPI.Game/Managers/TransportFactory.cs
2026-02-10 18:21:30 +01:00

32 lines
No EOL
626 B
C#

// WingsEmu
//
// Developed by NosWings Team
using System.Threading;
namespace WingsEmu.Game.Managers;
public class TransportFactory
{
private static TransportFactory _instance;
private long _lastTransportId = 100000;
private TransportFactory()
{
// do nothing
}
public static TransportFactory Instance => _instance ??= new TransportFactory();
public long GenerateTransportId()
{
Interlocked.Increment(ref _lastTransportId);
if (_lastTransportId >= long.MaxValue)
{
_lastTransportId = 0;
}
return _lastTransportId;
}
}