Snowflake/RPG.Services.Gameserver/Game/Entity/Factory/EntityFactory.cs

40 lines
1,016 B
C#
Raw Normal View History

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)
{
2024-01-25 10:55:10 +00:00
return new(NextEntityId(), avatarId, type, uid);
}
public NpcMonsterEntity CreateNpcMonsterEntity(LevelMonsterInfo levelMonster, uint groupId)
{
return new(NextEntityId(), groupId, levelMonster.ID, levelMonster.NPCMonsterID, levelMonster.EventID);
}
2024-01-25 10:55:10 +00:00
public PropEntity CreatePropEntity(LevelPropInfo levelProp, uint groupId)
{
return new(NextEntityId(), groupId, levelProp.ID, levelProp);
}
2024-01-25 11:31:32 +00:00
public NpcEntity CreateNpcEntity(LevelNPCInfo levelNPC, uint groupId)
{
return new(NextEntityId(), groupId, levelNPC.ID, levelNPC);
}
public void Reset()
{
_entityIdSeed = 0;
}
private uint NextEntityId()
{
return ++_entityIdSeed;
}
}