yyl
2026-02-09 5a4e34c8a85737c0fa5b5775122da31155cbaef3
Main/System/Battle/BattleObject/MinggeBattleObject.cs
@@ -2,22 +2,32 @@
using System;
using UnityEngine;
using Spine.Unity;
using System.Collections.Generic;
/// <summary>
/// 命格战斗对象 - 没有血量、没有实体,不会被攻击和选中,唯一作用是释放技能
/// </summary>
public class MinggeBattleObject : BattleObject
{
    public TeamMingge teamMingge { get; private set; }
    // Buff 管理器(命格现在也需要 buff 系统)
    public BattleObjectBuffMgr buffMgr;
    // 预留的命格 Buff 显示接口,供外部自定义显示逻辑
    public Action<List<HB428_tagSCBuffRefresh>> OnMinggeBuffRefresh;
    public MinggeBattleObject(BattleField _battleField) : base(_battleField)
    {
    }
    public override void Init(TeamHero _teamHero, BattleCamp _camp)
    public virtual void Init(TeamBase teamBase, TeamMingge _teamMingge, BattleCamp _camp)
    {
        teamHero = _teamHero;
        teamMingge = _teamMingge;
        Camp = _camp;
        ObjID = teamMingge.ObjID;
        
        // 命格只需要 buff 管理器用于技能效果
        // 初始化 buff 管理器
        buffMgr = new BattleObjectBuffMgr();
        buffMgr.Init(this);
        
@@ -27,7 +37,8 @@
    public override void Run()
    {
        // 命格运行逻辑(如果需要)
        // 更新 buff 管理器
        buffMgr?.Run();
    }
    public override void Pause()
@@ -42,11 +53,46 @@
    public override void Destroy()
    {
        // 清理显示回调
        OnMinggeBuffRefresh = null;
        // 清理 buff 管理器
        if (buffMgr != null)
        {
            buffMgr.Release();
            buffMgr = null;
        }
    }
    // ============ 实现抽象访问方法 ============
    public override BattleObjectBuffMgr GetBuffMgr() => buffMgr;
    public override int GetPositionNum() => teamMingge.positionNum;
    public override float GetModelScale() => teamMingge.modelScale;
    public override string GetName() => teamMingge.name;
    protected override bool GetIsStunned() => teamMingge.isStunned;
    protected override bool GetIsFrozen() => teamMingge.isFrozen;
    protected override bool GetIsStoned() => teamMingge.isStoned;
    protected override bool GetIsSlient() => teamMingge.isSlient;
    protected override bool GetIsDisarmed() => teamMingge.isDisarmed;
    protected override bool GetIsInvincible() => teamMingge.isInvinceble;
    protected override bool GetIsDead() => teamMingge.isDead;
    public override int GetRage() => teamMingge.rage;
    protected override void ApplyCasterHpChange(long newHp)
    {
        // 命格没有血量,忽略
    }
    public override long GetCurHp() => 0;
    public override long GetMaxHp() => 0;
    public override void SetCurHp(long value) { }
    public override void SetIsDead(bool value) { }
    public override int GetNPCID() => 0;
    public override long GetFightPower() => 0;
    // ============ 动画相关方法实现(命格没有动画) ============
    
@@ -60,10 +106,41 @@
        // 命格没有幻影
    }
    
    public override Spine.TrackEntry PlaySkillAnimation(SkillConfig skillConfig, SkillBase skillBase, bool isCounter, Action onComplete)
    public override Spine.TrackEntry PlaySkillAnimation(SkillConfig skillConfig, SkillSkinConfig skillSkinConfig, SkillBase skillBase, bool isCounter, Action onComplete)
    {
        // 命格没有技能动画,直接完成
        // 命格没有技能动画,立即触发所有帧事件
        int loopCount = skillSkinConfig.LoopCount + 1; //默认会有一次
        int frameCount = skillSkinConfig.ActiveFrames.Length;
        // 1. 技能开始
        skillBase.OnSkillStart();
        // 2. 前摇结束
        skillBase.OnStartSkillFrameEnd();
        // 3. 循环执行中摇
        int triggerCount = 0;
        for (int currentLoop = 0; currentLoop < loopCount; currentLoop++)
        {
            // 每个 loop 开始时调用 OnMiddleFrameStart
            skillBase.OnMiddleFrameStart(currentLoop);
            // 触发该 loop 的所有 ActiveFrame
            for (int i = 0; i < frameCount; i++)
            {
                skillBase.OnMiddleFrameEnd(currentLoop, triggerCount++);
            }
        }
        // 4. 后摇开始
         skillBase.OnFinalFrameStart();
        // 5. 完成回调
        onComplete?.Invoke();
        // 6. 后摇结束
        skillBase.OnFinalFrameEnd();
        return null;
    }
    
@@ -73,7 +150,7 @@
        return false;
    }
    
    public override bool CanCastSkillAnimation(SkillConfig skillConfig)
    public override bool CanCastSkillAnimation(SkillSkinConfig skillSkinConfig)
    {
        // 命格总是可以释放技能(从动画角度)
        return true;
@@ -99,7 +176,7 @@
        return null;
    }
    public override void OnDodgeBegin()
    public override void OnDodgeBegin(DamageType damageType)
    {
        // 命格不需要闪避
    }
@@ -130,9 +207,10 @@
    public override void HaveRest()
    {
        // 命格不需要休息状态
        // 清理 buff
        buffMgr?.RemoveAllBuff();
    }
    public override void SetSpeedRatio(float ratio)
    {
        // 命格不需要速度控制