/// <summary> /// 创建血条 /// </summary> /// <param name="tagert">血条模板 Prefab </param> /// <param name="parent">父节点</param> /// <returns></returns> public static LYXHeroBlood CreateBlood(GameObject tagert, Transform parent) { GameObject bgo = GameObject.Instantiate(tagert) as GameObject; if (bgo == null) { return(null); } Transform btrans = bgo.transform; if (parent != null) { btrans.parent = parent; } btrans.localPosition = Vector3.zero; btrans.localRotation = Quaternion.identity; btrans.localScale = Vector3.one; LYXHeroBlood blood = LCSCompHelper.FindComponet <LYXHeroBlood>(bgo); // 血条 blood.bloodSlider = btrans.Find("blood/bloodslider").GetComponent <UISlider>(); //怒气 blood.angSlider = btrans.Find("anger/angerslider").GetComponent <UISlider>(); blood.mBloodTime = 0; blood.mIsRefresh = false; blood.gameObject.SetActive(false); return(blood); }
/// <summary> /// 初始化血条的信息 /// </summary> public void InitHeroBloodInfo() { if (mBatManage == null || mBatManage.m2DUIRoot == null || mBatManage.mBlood == null) { return; } LYXHeroBlood heroBlood = LYXHeroBlood.CreateBlood(mBatManage.mBlood, mBatManage.m2DUIRoot.transform); if (heroBlood == null) { return; } heroBlood.transform.localRotation = Quaternion.Euler(new Vector3(0, mHeroEnity.FriendAndFoe == 1 ? -90 : 90, 0)); heroBlood.SetBloodPostion(gameObject, new Vector3(0, 200, 0)); heroBlood.mHeroEntity = mHeroEnity; mHeroBlood = heroBlood; }
/// <summary> /// 初始化血条的信息 /// </summary> public void InitHeroBloodInfo() { if (mBatManage == null || mBatManage.m2DUIRoot == null || mBatManage.mBlood == null) return; LYXHeroBlood heroBlood = LYXHeroBlood.CreateBlood(mBatManage.mBlood, mBatManage.m2DUIRoot.transform); if (heroBlood == null) return; heroBlood.transform.localRotation = Quaternion.Euler(new Vector3(0, mHeroEnity.FriendAndFoe == 1 ? -90 : 90, 0)); heroBlood.SetBloodPostion(gameObject, new Vector3(0, 200, 0)); heroBlood.mHeroEntity = mHeroEnity; mHeroBlood = heroBlood; }