Unit.cs 925 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using PF;
  2. using UnityEngine;
  3. using Quaternion = UnityEngine.Quaternion;
  4. using Vector3 = UnityEngine.Vector3;
  5. namespace ETModel
  6. {
  7. [ObjectSystem]
  8. public class UnitAwakeSystem : AwakeSystem<Unit, GameObject>
  9. {
  10. public override void Awake(Unit self, GameObject gameObject)
  11. {
  12. self.Awake(gameObject);
  13. }
  14. }
  15. [HideInHierarchy]
  16. public sealed class Unit: Entity
  17. {
  18. public void Awake(GameObject gameObject)
  19. {
  20. this.ViewGO = gameObject;
  21. this.ViewGO.AddComponent<ComponentView>().Component = this;
  22. }
  23. public Vector3 Position
  24. {
  25. get
  26. {
  27. return ViewGO.transform.position;
  28. }
  29. set
  30. {
  31. ViewGO.transform.position = value;
  32. }
  33. }
  34. public Quaternion Rotation
  35. {
  36. get
  37. {
  38. return ViewGO.transform.rotation;
  39. }
  40. set
  41. {
  42. ViewGO.transform.rotation = value;
  43. }
  44. }
  45. public override void Dispose()
  46. {
  47. if (this.IsDisposed)
  48. {
  49. return;
  50. }
  51. base.Dispose();
  52. }
  53. }
  54. }