GlobalComponent.cs 784 B

123456789101112131415161718192021222324252627
  1. using UnityEngine;
  2. namespace ET
  3. {
  4. [EntitySystemOf(typeof(GlobalComponent))]
  5. public static partial class GlobalComponentSystem
  6. {
  7. [EntitySystem]
  8. public static void Awake(this GlobalComponent self)
  9. {
  10. self.Global = GameObject.Find("/Global").transform;
  11. self.Unit = GameObject.Find("/Global/Unit").transform;
  12. self.UI = GameObject.Find("/Global/UI").transform;
  13. self.GlobalConfig = Resources.Load<GlobalConfig>("GlobalConfig");
  14. }
  15. }
  16. [ComponentOf(typeof(Scene))]
  17. public class GlobalComponent: Entity, IAwake
  18. {
  19. public Transform Global;
  20. public Transform Unit { get; set; }
  21. public Transform UI;
  22. public GlobalConfig GlobalConfig { get; set; }
  23. }
  24. }