UnitEnterSightRange_NotifyClient.cs 693 B

12345678910111213141516171819202122232425262728
  1. namespace ET.Server
  2. {
  3. // 进入视野通知
  4. [Event]
  5. public class UnitEnterSightRange_NotifyClient: AEvent<EventType.UnitEnterSightRange>
  6. {
  7. protected override async ETTask Run(EventType.UnitEnterSightRange args)
  8. {
  9. await ETTask.CompletedTask;
  10. AOIEntity a = args.A;
  11. AOIEntity b = args.B;
  12. if (a.Id == b.Id)
  13. {
  14. return;
  15. }
  16. Unit ua = a.GetParent<Unit>();
  17. if (ua.Type != UnitType.Player)
  18. {
  19. return;
  20. }
  21. Unit ub = b.GetParent<Unit>();
  22. Server.UnitHelper.NoticeUnitAdd(ua, ub);
  23. }
  24. }
  25. }