TH1/Unity/Assets/Scripts/Loader/GlobalComponent.cs
2025-07-17 18:26:28 +08:00

27 lines
778 B
C#

using UnityEngine;
namespace ET
{
[FriendOf(typeof(GlobalComponent))]
public static partial class GlobalComponentSystem
{
[EntitySystem]
public static void Awake(this GlobalComponent self)
{
self.Global = GameObject.Find("/Global").transform;
self.Unit = GameObject.Find("/Global/Unit").transform;
self.UI = GameObject.Find("/Global/UI").transform;
self.GlobalConfig = Resources.Load<GlobalConfig>("GlobalConfig");
}
}
[ComponentOf(typeof(Scene))]
public class GlobalComponent: Entity, IAwake
{
public Transform Global;
public Transform Unit { get; set; }
public Transform UI;
public GlobalConfig GlobalConfig { get; set; }
}
}