CTT/Server/Hotfix/Demo/M2M_TrasferUnitRequestHandl...

22 lines
678 B
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
namespace ET
{
[ActorMessageHandler]
public class M2M_TrasferUnitRequestHandler : AMActorRpcHandler<Scene, M2M_TrasferUnitRequest, M2M_TrasferUnitResponse>
{
protected override async ETTask Run(Scene scene, M2M_TrasferUnitRequest request, M2M_TrasferUnitResponse response, Action reply)
{
Unit unit = request.Unit;
// 将unit加入事件系统
Log.Debug(MongoHelper.ToJson(request.Unit));
// 这里不需要注册location因为unlock会更新位置
unit.AddComponent<MailBoxComponent>();
scene.GetComponent<MapUnitComponent>().Add(unit);
response.InstanceId = unit.InstanceId;
reply();
await ETTask.CompletedTask;
}
}
}