AOIEntity.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections.Generic;
  2. using Unity.Mathematics;
  3. namespace ET.Server
  4. {
  5. [ComponentOf(typeof(Unit))]
  6. public class AOIEntity: Entity, IAwake<int, float3>, IDestroy
  7. {
  8. public Unit Unit => this.GetParent<Unit>();
  9. public int ViewDistance;
  10. public Cell Cell;
  11. // 观察进入视野的Cell
  12. public HashSet<long> SubEnterCells = new HashSet<long>();
  13. // 观察离开视野的Cell
  14. public HashSet<long> SubLeaveCells = new HashSet<long>();
  15. // 观察进入视野的Cell
  16. public HashSet<long> enterHashSet = new HashSet<long>();
  17. // 观察离开视野的Cell
  18. public HashSet<long> leaveHashSet = new HashSet<long>();
  19. // 我看的见的Unit
  20. public Dictionary<long, AOIEntity> SeeUnits = new Dictionary<long, AOIEntity>();
  21. // 看见我的Unit
  22. public Dictionary<long, AOIEntity> BeSeeUnits = new Dictionary<long, AOIEntity>();
  23. // 我看的见的Player
  24. public Dictionary<long, AOIEntity> SeePlayers = new Dictionary<long, AOIEntity>();
  25. // 看见我的Player单独放一个Dict,用于广播
  26. public Dictionary<long, AOIEntity> BeSeePlayers = new Dictionary<long, AOIEntity>();
  27. }
  28. }