34 lines
861 B
C#
34 lines
861 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 void Reset()
|
|
{
|
|
_entityIdSeed = 0;
|
|
}
|
|
|
|
private uint NextEntityId()
|
|
{
|
|
return ++_entityIdSeed;
|
|
}
|
|
}
|