Snowflake/RPG.Services.Gameserver/Game/Entity/EntityBase.cs

49 lines
1 KiB
C#

using RPG.Network.Proto;
namespace RPG.Services.Gameserver.Game.Entity;
internal abstract class EntityBase
{
public uint Id { get; }
public uint GroupId { get; }
public uint InstanceId { get; }
private MotionInfo _motion;
public EntityBase(uint id, uint groupId, uint instanceId)
{
Id = id;
GroupId = groupId;
InstanceId = instanceId;
_motion = new()
{
Pos = new(),
Rot = new()
};
}
public abstract EntityType Type { get; }
public void SetMotion(MotionInfo motion)
{
_motion = motion;
}
public virtual SceneEntityInfo SceneEntityInfo
{
get
{
return new()
{
EntityId = Id,
GroupId = GroupId,
InstId = InstanceId,
Motion = _motion.Clone()
};
}
}
public Vector Position => _motion.Pos.Clone();
public Vector Rotation => _motion.Rot.Clone();
}