using UnityEngine; namespace Model { public static class UnitFactory { public static Unit Create(long id) { ResourcesComponent resourcesComponent = Game.Scene.GetComponent(); GameObject bundleGameObject = resourcesComponent.GetAsset("Unit.unity3d", "Unit"); GameObject prefab = bundleGameObject.Get("Skeleton"); UnitComponent unitComponent = Game.Scene.GetComponent(); Unit unit = EntityFactory.CreateWithId(id); unit.GameObject = UnityEngine.Object.Instantiate(prefab); GameObject parent = GameObject.Find($"/Global/Unit"); unit.GameObject.transform.SetParent(parent.transform, false); unit.AddComponent(); unit.AddComponent(); unitComponent.Add(unit); return unit; } } }