using UnityEngine; namespace ET.Client { [EntitySystemOf(typeof(LSUnitViewComponent))] public static partial class LSUnitViewComponentSystem { [EntitySystem] private static void Awake(this LSUnitViewComponent self) { } [EntitySystem] private static void Destroy(this LSUnitViewComponent self) { } public static async ETTask InitAsync(this LSUnitViewComponent self) { Room room = self.Room(); LSUnitComponent lsUnitComponent = room.LSWorld.GetComponent(); Scene root = self.Root(); foreach (long playerId in room.PlayerIds) { LSUnit lsUnit = lsUnitComponent.GetChild(playerId); string assetsName = $"Assets/Bundles/Unit/Unit.prefab"; GameObject bundleGameObject = await room.GetComponent().LoadAssetAsync(assetsName); GameObject prefab = bundleGameObject.Get("Skeleton"); GlobalComponent globalComponent = root.GetComponent(); GameObject unitGo = UnityEngine.Object.Instantiate(prefab, globalComponent.Unit, true); unitGo.transform.position = lsUnit.Position.ToVector(); LSUnitView lsUnitView = self.AddChildWithId(lsUnit.Id, unitGo); lsUnitView.AddComponent(); } } } }