예제 #1
0
    public void AddHpItemInfo(string mName, Transform trans, int hp)
    {
        ItemEntityHP item = null;

        if (itemDic.TryGetValue(mName, out item))
        {
            return;
        }
        else
        {
            GameObject go = resSvc.LoadPrefab(PathDefine.HPItemPrefab, true);
            go.transform.SetParent(hpItemRoot);
            go.transform.localPosition = new Vector3(-1000, 0, 0);
            ItemEntityHP ieh = go.GetComponent <ItemEntityHP>();
            ieh.InitItemInfo(trans, hp);
            itemDic.Add(mName, ieh);
        }
    }
예제 #2
0
    public void AddHPItemInfo(string mName, int hp, Transform trans, bool isBoss = false)
    {
        ItemEntityHP item = null;

        if (itemDic.TryGetValue(mName, out item))
        {
            return;
        }
        else
        {
            GameObject go = resSvc.LoadPrefab(PathDefine.HPDynamic);
            go.transform.SetParent(hpItemRoot);
            go.transform.localPosition = new Vector3(-1000, 0, 0);
            ItemEntityHP itemCom = go.GetComponent <ItemEntityHP>();
            itemCom.InitItemInfo(trans, hp, isBoss);//boss血条不显示,但还要出伤害
            itemDic.Add(mName, itemCom);
        }
    }
예제 #3
0
    private void LoadAssetSucessCallBack(string assetName, object asset, float duration, object userData)
    {
        GameObject             go = asset as GameObject;
        AddHpItemInfoEventArgs ne = userData as AddHpItemInfoEventArgs;

        if (!go || ne == null)
        {
            Debug.LogError("Sprite:" + assetName + "资源不存在");
            return;
        }

        go = Instantiate(go);
        go.transform.SetParent(hpItemRoot);
        go.transform.localPosition = new Vector3(-1000, 0, 0);
        ItemEntityHP ieh = go.GetComponent <ItemEntityHP>();

        ieh.InitItemInfo(ne.Tf, ne.Hp);
        itemDic.Add(ne.Name, ieh);
        GameEntry.Resource.UnloadAsset(asset);
        ReferencePool.Release(ne);
    }