Files
DanhengServer-OpenSource/GameServer/Game/Scene/Entity/EntityNpc.cs
Somebody 87d228eb79 Feature:Asynchronous Operation & Formatting Code
- Now the async operation is enabled!
- Code formatted by Resharper plugin <3
2024-07-22 17:12:03 +08:00

48 lines
1.4 KiB
C#

using EggLink.DanhengServer.Data.Config;
using EggLink.DanhengServer.Game.Battle;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Util;
namespace EggLink.DanhengServer.Game.Scene.Entity;
public class EntityNpc(SceneInstance scene, GroupInfo group, NpcInfo npcInfo) : IGameEntity
{
public SceneInstance Scene { get; set; } = scene;
public Position Position { get; set; } = npcInfo.ToPositionProto();
public Position Rotation { get; set; } = npcInfo.ToRotationProto();
public int NpcId { get; set; } = npcInfo.NPCID;
public int InstId { get; set; } = npcInfo.ID;
public int EntityID { get; set; }
public int GroupID { get; set; } = group.Id;
public async ValueTask AddBuff(SceneBuff buff)
{
await System.Threading.Tasks.Task.CompletedTask;
}
public async ValueTask ApplyBuff(BattleInstance instance)
{
await System.Threading.Tasks.Task.CompletedTask;
}
public virtual SceneEntityInfo ToProto()
{
SceneNpcInfo npc = new()
{
NpcId = (uint)NpcId
};
return new SceneEntityInfo
{
EntityId = (uint)EntityID,
GroupId = (uint)GroupID,
Motion = new MotionInfo
{
Pos = Position.ToProto(),
Rot = Rotation.ToProto()
},
InstId = (uint)InstId,
Npc = npc
};
}
}