示例#1
0
        public void DelHudTroop(int troopID)
        {
            HudTroop hudcity = dic_troop[troopID];

            if (hudcity)
            {
                Destroy(hudcity);
            }
        }
示例#2
0
        public void AddHudTroop(int troopid)
        {
            Troop    troop    = EntityMgr.Instacne.dic_Troop[troopid];
            HudTroop hudTroop = Instantiate(hudTroopPrefab);

            hudTroop.transform.SetParent(transform, true);
            hudTroop.Init(troop);

            hudTroop.gameObject.SetActive(true);
            hudTroop.Update(); //没有setActive  Awake方法不一定执行
            //troop.onHpChange +=
            dic_troop.Add(troopid, hudTroop);
        }