Пример #1
0
    public void OnMonsterLoaded(GameObject m)
    {
        MonsterController controller = m.GetComponent <MonsterController>();
        MonsterData       md         = controller.MonsterEntityData.MD;//晚于OnShow执行
        EntityMonster     em         = new EntityMonster {
            BattleMgr = this,
            StateMgr  = m_StateMgr,
            SkillMgr  = m_SkillMgr
        };

        //设置初始属性
        em.Md = md;
        em.SetBattleProps(md.mCfg.bps);
        em.Name = "m" + md.mWave + "_" + md.mIndex;

        MonsterController mc = m.GetComponent <MonsterController>();

        mc.Init();
        em.SetCtrl(mc);

        mc.gameObject.SetActive(false);
        monsterDic.Add(m.name, em);
        if (md.mCfg.mType == MonsterType.Normal)
        {
            GameEntry.UI.AddHpItemInfo(m.name, mc.hpRoot, em.HP);
        }
        else if (md.mCfg.mType == MonsterType.Boss)
        {
            SetBossHPBarStateEventArgs stateEventArgs = ReferencePool.Acquire <SetBossHPBarStateEventArgs>();
            stateEventArgs.Fill(true);
            GameEntry.Event.Fire(this, stateEventArgs);
        }
    }
Пример #2
0
    public void SetBossHPBarState(object sender, GameEventArgs e)
    {
        SetBossHPBarStateEventArgs ne = e as SetBossHPBarStateEventArgs;

        SetActive(transBossHPBar, ne.State);
        imgRed.fillAmount    = 1;
        imgYellow.fillAmount = 1;
    }