NavAgentComponent.cs 692 B

123456789101112131415161718192021222324252627
  1. // --------------------------
  2. // 作者:烟雨迷离半世殇
  3. // 邮箱:1778139321@qq.com
  4. // 日期:2022年7月16日, 星期六
  5. // --------------------------
  6. using Cysharp.Threading.Tasks;
  7. using Pathfinding;
  8. namespace ET
  9. {
  10. /// <summary>
  11. /// 添加此组件代表拥有寻路能力
  12. /// </summary>
  13. public class NavAgentComponent : Entity, IAwake
  14. {
  15. /// <summary>
  16. /// 多线程适配
  17. /// </summary>
  18. public UniTaskCompletionSource<ABPath> PathFindResultTcs = new UniTaskCompletionSource<ABPath>();
  19. public void OnPathFindFinish(Path path)
  20. {
  21. PathFindResultTcs.TrySetResult(path as ABPath);
  22. }
  23. }
  24. }