Exemplo n.º 1
0
    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);
        }
    }
Exemplo n.º 2
0
    public void SetHP(string mName, int oldHp, int curtHp)
    {
        ItemEntityHP iehp = null;

        if (itemDic.TryGetValue(mName, out iehp))
        {
            iehp.SetHP(oldHp, curtHp);
        }
    }