Ejemplo n.º 1
0
        /// <summary>
        /// 受伤处理
        /// </summary>
        /// <param name="e"></param>
        private void onHeroHurtCall(GameEvent e)
        {
            ObjectHero hero = (ObjectHero)e.data;

            if (hero != null)
            {
                UpdateBloodValue(hero.GetGuid(), (float)hero.GetHP() / hero.GetMaxHP());
            }
        }
Ejemplo n.º 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());
        }