public static async ETTask <GameObject> LoadLoungeIconBundle() { ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>(); imageLoungeIconBundle = await resourcesComponent.LoadAssetAsync(ResourcesPathType.Image, imageIconBundleName) as GameObject; return(imageLoungeIconBundle); }
public static async ETTask <GameObject> GetLoungeCharactorShowRoom() { ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>(); GameObject bundleObj = await resourcesComponent.LoadAssetAsync(ResourcesPathType.DynamicObj, "LoungeCharactorShowRoom") as GameObject; GameObject instanceObj = UnityEngine.Object.Instantiate(bundleObj); return(instanceObj); }
/// <summary> /// 根據資源名稱創造腳色模型 /// </summary> /// <param name="resName"></param> /// <returns></returns> public static async ETTask <GameObject> CreateCharacterModel(string resName) { ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>(); //不用先LoadBundleAsync,底層會自動做 GameObject bundleGameObject = await resourcesComponent.LoadAssetAsync(ResourcesPathType.Avatar, resName) as GameObject; GameObject go = UnityEngine.Object.Instantiate(bundleGameObject); go.name = resName; return(go); }
public static async ETTask <GameObject> CreateAppearanceModel(string resName, Transform parent = null) { ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>(); GameObject bundleObj = await resourcesComponent.LoadAssetAsync(ResourcesPathType.DynamicObj, resName) as GameObject; GameObject instanceObj = UnityEngine.Object.Instantiate(bundleObj, parent, false); instanceObj.transform.localPosition = Vector3.zero; instanceObj.transform.localEulerAngles = Vector3.zero; return(instanceObj); }
public static async ETTask <GameObject> CreateCharacterModel(long Id) { CharacterConfig config = GetCharacterConfig(Id); if (config == null || config.Type != (int)ConfigType.Character) { return(null); } ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>(); //不用先LoadBundleAsync,底層會自動做 GameObject bundleGameObject = await resourcesComponent.LoadAssetAsync(ResourcesPathType.Avatar, config.Name) as GameObject; GameObject go = UnityEngine.Object.Instantiate(bundleGameObject); go.name = config.Name; return(go); }