AOIEntity.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. private EntityRef<Cell> cell;
  11. public Cell Cell
  12. {
  13. get
  14. {
  15. return this.cell;
  16. }
  17. set
  18. {
  19. this.cell = value;
  20. }
  21. }
  22. // 观察进入视野的Cell
  23. public HashSet<long> SubEnterCells = new HashSet<long>();
  24. // 观察离开视野的Cell
  25. public HashSet<long> SubLeaveCells = new HashSet<long>();
  26. // 观察进入视野的Cell
  27. public HashSet<long> enterHashSet = new HashSet<long>();
  28. // 观察离开视野的Cell
  29. public HashSet<long> leaveHashSet = new HashSet<long>();
  30. // 我看的见的Unit
  31. public Dictionary<long, EntityRef<AOIEntity>> SeeUnits = new Dictionary<long, EntityRef<AOIEntity>>();
  32. // 看见我的Unit
  33. public Dictionary<long, EntityRef<AOIEntity>> BeSeeUnits = new Dictionary<long, EntityRef<AOIEntity>>();
  34. // 我看的见的Player
  35. public Dictionary<long, EntityRef<AOIEntity>> SeePlayers = new Dictionary<long, EntityRef<AOIEntity>>();
  36. // 看见我的Player单独放一个Dict,用于广播
  37. public Dictionary<long, EntityRef<AOIEntity>> BeSeePlayers = new Dictionary<long, EntityRef<AOIEntity>>();
  38. }
  39. }