using UnityEngine; namespace ET.Client { [EntitySystemOf(typeof(LSUnitViewComponent))] public static partial class LSUnitViewComponentSystem { [EntitySystem] private static void Awake(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); ResourcesComponent resourcesComponent = root.GetComponent(); GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset("Unit.unity3d", "Unit"); 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(); } } [EntitySystem] private static void Destroy(this LSUnitViewComponent self) { } } }