Example #1
0
        public UI_Blood CreateBloodBar(ObjectMonster monster)
        {
            Transform tans = monster.GetAnimation().EventControl.Pre_Head_T_EffectPoint;

            GameObject      barObj   = null;
            MonsterTemplate template = (MonsterTemplate)DataTemplate.GetInstance().m_MonsterTable.getTableData(monster.GetTableID());

            if (template.getMonstertype() == 1)
            {
                barObj = Instantiate(UI_FightControler.Inst.monsterBloodPre) as GameObject;
            }

            else
            {
                barObj = Instantiate(UI_FightControler.Inst.bossBloodBar) as GameObject;
            }
            barObj.transform.SetParent(transform, false);

            UI_Blood mBlood = barObj.AddComponent <UI_Blood>();

            mBlood.SetPosition(tans.position);
            barObj.transform.localScale = new Vector3(1, 1, 1);
            bloodInfo.Add(mBlood);
            mBlood.isHero = false;
            if (ObjectSelf.GetInstance().LimitFightMgr.m_bStartEnter)
            {
                int CurRound = ObjectSelf.GetInstance().LimitFightMgr.m_RoundNum;
                UltimatetrialmonsterTemplate row = (UltimatetrialmonsterTemplate)DataTemplate.GetInstance().m_UltimatetrialmonsterTable.getTableData(CurRound);
                int nLevel = template.getMonsterlevel() + row.getAdditionalLevel();
                mBlood.setHeroLevel(nLevel);
            }
            else
            {
                mBlood.setHeroLevel(template.getMonsterlevel());
            }
            mBlood.setHeadPosition(tans);
            mBlood.uid.Copy(monster.GetGuid());

            return(mBlood);
        }
Example #2
0
        //创建血条
        public void CreateBloodBar(ObjectHero hero)
        {
            Transform tans = hero.GetAnimation().EventControl.Pre_Head_T_EffectPoint;

            GameObject barObj = Instantiate(UI_FightControler.Inst.heroBloodPre, Vector3.zero, Quaternion.identity) as GameObject;

            barObj.transform.SetParent(transform, false);
            UI_Blood mBlood = barObj.AddComponent <UI_Blood>();

            mBlood.SetPosition(tans.position);
            barObj.transform.localScale = new Vector3(1, 1, 1);
            bloodInfo.Add(mBlood);
            mBlood.isHero = true;
            mBlood.setHeroLevel(hero.GetHeroData().Level);
            if (!ObjectSelf.GetInstance().LimitFightMgr.m_bStartEnter)
            {
                hero.SetHP(hero.GetMaxHP());
            }
            mBlood.SetValue((float)hero.GetHP() / (float)hero.GetMaxHP());
            mBlood.setHeadPosition(tans);
            mBlood.uid.Copy(hero.GetGuid());
        }