WutheringWaves/GameServer/Systems/Entity/EntityFactory.cs

13 lines
405 B
C#
Raw Normal View History

2024-02-10 16:04:03 +00:00
namespace GameServer.Systems.Entity;
internal class EntityFactory
{
private long _entityIdCounter;
public PlayerEntity CreatePlayer(int characterConfigId, int playerId)
=> new(NextId(), characterConfigId, playerId);
public MonsterEntity CreateMonster(int levelEntityId) => new(NextId(), levelEntityId);
2024-02-10 16:04:03 +00:00
private long NextId() => Interlocked.Increment(ref _entityIdCounter);
}