public void AddHpItemInfo(string mName, int hp, Transform trans) { ItemEntityHP itemEntityHp = null; if (itemDic.TryGetValue(mName, out itemEntityHp)) { itemEntityHp.SetHP(trans, hp); } else { GameObject go = resSvc.LoadPrefab(PathDefine.ItemEntityHPPrefab, true); go.transform.SetParent(itemRootTrans); go.transform.localPosition = new Vector2(1000, 0); itemEntityHp = go.GetComponent <ItemEntityHP>(); itemEntityHp.SetHP(trans, hp); itemDic.Add(mName, itemEntityHp); } }
public void SetHP(string mName, int oldHp, int curtHp) { ItemEntityHP iehp = null; if (itemDic.TryGetValue(mName, out iehp)) { iehp.SetHP(oldHp, curtHp); } }