技巧11 FGUI緩動減血

阿狐(師從飛羽)發表於2020-10-15

技巧11 FGUI緩動減血

FGUI緩動減血

 /**法術直接改變怪物血量 */
    public ChangeMonsterHp(changeValue: number)
    {
        //改變怪物生命
        this._monsterCurrentHP = GameMgr.getInstance().ChangeHP(changeValue, this._monsterCurrentHP, this._monsterMaxHP);
        let num2: number = this._monsterCurrentHP / this._monsterMaxHP;
        //改變顯示(非緩動減血)
        // this._HPBarEnemy.fillAmount = this._monsterCurrentHP / this._monsterMaxHP;
        //改變顯示(緩動減血)
        fgui.GTween.to(this._HPBarEnemy.fillAmount, num2, 0.5).setTarget(this._HPBarEnemy, 'fillAmount');

        //判斷結算
        this.HPValue(this._monsterCurrentHP);
    }

相關文章