MoveComponent.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using Unity.Mathematics;
  4. namespace ET
  5. {
  6. [ComponentOf(typeof(Unit))]
  7. public class MoveComponent: Entity, IAwake, IDestroy
  8. {
  9. public float3 PreTarget
  10. {
  11. get
  12. {
  13. return this.Targets[this.N - 1];
  14. }
  15. }
  16. public float3 NextTarget
  17. {
  18. get
  19. {
  20. return this.Targets[this.N];
  21. }
  22. }
  23. // 开启移动协程的时间
  24. public long BeginTime;
  25. // 每个点的开始时间
  26. public long StartTime { get; set; }
  27. // 开启移动协程的Unit的位置
  28. public float3 StartPos;
  29. public float3 RealPos
  30. {
  31. get
  32. {
  33. return this.Targets[0];
  34. }
  35. }
  36. private long needTime;
  37. public long NeedTime
  38. {
  39. get
  40. {
  41. return this.needTime;
  42. }
  43. set
  44. {
  45. this.needTime = value;
  46. }
  47. }
  48. public long MoveTimer;
  49. public float Speed; // m/s
  50. public ETTask<bool> tcs;
  51. public List<float3> Targets = new List<float3>();
  52. public float3 FinalTarget
  53. {
  54. get
  55. {
  56. return this.Targets[this.Targets.Count - 1];
  57. }
  58. }
  59. public int N;
  60. public int TurnTime;
  61. public bool IsTurnHorizontal;
  62. public quaternion From;
  63. public quaternion To;
  64. }
  65. }