Snowflake/RPG.Services.Gameserver/Game/Entity/Factory/EntityFactory.cs
2024-01-25 14:31:32 +03:00

39 lines
1,016 B
C#

using RPG.GameCore.Level.Objects;
using RPG.Network.Proto;
namespace RPG.Services.Gameserver.Game.Entity.Factory;
internal class EntityFactory
{
private uint _entityIdSeed;
public AvatarEntity CreateAvatarEntity(uint avatarId, AvatarType type, uint uid)
{
return new(NextEntityId(), avatarId, type, uid);
}
public NpcMonsterEntity CreateNpcMonsterEntity(LevelMonsterInfo levelMonster, uint groupId)
{
return new(NextEntityId(), groupId, levelMonster.ID, levelMonster.NPCMonsterID, levelMonster.EventID);
}
public PropEntity CreatePropEntity(LevelPropInfo levelProp, uint groupId)
{
return new(NextEntityId(), groupId, levelProp.ID, levelProp);
}
public NpcEntity CreateNpcEntity(LevelNPCInfo levelNPC, uint groupId)
{
return new(NextEntityId(), groupId, levelNPC.ID, levelNPC);
}
public void Reset()
{
_entityIdSeed = 0;
}
private uint NextEntityId()
{
return ++_entityIdSeed;
}
}