hch
2025-09-04 62188b271cce5e3aec5ca40d58c30f08643e2f60
Main/System/Battle/BattleObject/BattleObject.cs
@@ -52,7 +52,6 @@
    private RectTransform m_heroRectTrans;
    private BattleHeroInfoBar battleHeroInfoBar;
    public RectTransform heroRectTrans
    {
@@ -93,13 +92,19 @@
        heroInfoBar = heroGo.GetComponentInChildren<BattleHeroInfoBar>(true);
        heroInfoBar.SetBattleObject(this);
        //  根据阵营翻转血条
        var heroInfoBarScale = heroInfoBar.transform.localScale;
        heroInfoBarScale.x *= Camp == BattleCamp.Red ? 1 : -1;
        heroInfoBar.transform.localScale = heroInfoBarScale;
    }
    public virtual void Run()
    {
        motionBase.Run();
        battleHeroInfoBar.Run();
        heroInfoBar.Run();
    }
    public virtual void Pause()
@@ -134,17 +139,19 @@
        {
            case PlayerDataType.HP:
                long toHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
                battleHeroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp);
                heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp);
                teamHero.curHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
                break;
            case PlayerDataType.MaxHP:
                teamHero.maxHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
                break;
            case PlayerDataType.XP:
                long toXp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
                heroInfoBar.UpdateHP(teamHero.rage, toXp, 100);
                teamHero.rage = (int)GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
                break;
            default:
                BattleDebug.LogError("BattleObject.ObjInfoRefresh 出现意外类型 " + _refreshInfo.RefreshType.ToString());
                Debug.LogError("BattleObject.ObjInfoRefresh 出现意外类型 " + _refreshInfo.RefreshType.ToString());
                break;
        }
    }
@@ -232,14 +239,24 @@
        return true;
    }
    public virtual void Hurt(List<long> damageValues, long _totalDamage, uint attackType)
    public virtual void Hurt(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig)
    {
        PopDamage(teamHero.curHp, damageValues, attackType);
        PopDamage(damageValues, hurt, skillConfig);
        motionBase.PlayAnimation(MotionName.hit, false);
        //  扣血
        //  扣血流给别的敌方刷新好了
        teamHero.curHp -= _totalDamage;
    }
    public void SuckHp(uint suckHP, SkillConfig skillConfig)
    {
    }
    public void HurtByReflect(uint bounceHP, SkillConfig skillConfig)
    {
    }
    //  闪避开始
@@ -267,14 +284,13 @@
    public virtual void OnDeath(Action _onDeathAnimationComplete)
    {
        BattleDebug.LogError(ObjID + " OnDeath called");
        onDeathAnimationComplete = _onDeathAnimationComplete;
        motionBase.PlayAnimation(MotionName.dead, false);
    }
    protected virtual void OnAnimationComplete(MotionName motionName)
    protected virtual void OnAnimationComplete(string motionName)
    {
        if (motionName == MotionName.dead)
        if (motionName == MotionName.dead.ToString().ToLower())
        {
            OnDeadAnimationComplete();
            onDeathAnimationComplete?.Invoke();
@@ -297,18 +313,9 @@
    }
    // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给
    protected virtual void PopDamage(long curHp, List<long> damageValues, uint attackType)
    protected virtual void PopDamage(List<long> damageValues, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig)
    {
        //  其实应该通知出去给UI界面解耦 让UI界面自己来显示的 YYL TODO
        //  播放伤害数字
        //  这里可以实现一个伤害数字的弹出效果
        //  比如使用一个UI组件来显示伤害数字
        foreach (var damage in damageValues)
        {
            Debug.Log($"Damage: {damage}");
        }
        BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, (int)attackType);
        BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, hurt, skillConfig);
        // YYL TODO 是否需要挂在在自身的follow点上
        EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
@@ -346,7 +353,7 @@
    public void PerformDrop()
    {
        if (null == battleDrops)
        if (null == battleDrops || battleDrops.dropItemPackIndex.Count == 0)
            return;
        EventBroadcast.Instance.Broadcast<string, BattleDrops, Action>(
@@ -360,6 +367,8 @@
#if UNITY_EDITOR_STOP_USING
    public void EditorRevive()
    {