lcy
2026-02-04 e80cb92bf4b84cab4d87bf3a23bbf21da311cd03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
 
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 virtual void Init(TeamBase teamBase, TeamMingge _teamMingge, BattleCamp _camp)
    {
        teamMingge = _teamMingge;
        Camp = _camp;
        ObjID = teamMingge.ObjID;
        
        // 初始化 buff 管理器
        buffMgr = new BattleObjectBuffMgr();
        buffMgr.Init(this);
        
        layerMgr = new BattleObjectLayerMgr();
        layerMgr.Init(this);
    }
 
    public override void Run()
    {
        // 更新 buff 管理器
        buffMgr?.Run();
    }
 
    public override void Pause()
    {
        // 命格暂停
    }
 
    public override void Resume()
    {
        // 命格恢复
    }
 
    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;
 
    // ============ 动画相关方法实现(命格没有动画) ============
    
    public override void PlayAnimation(MotionName motionName, bool loop)
    {
        // 命格没有动画
    }
    
    public override void ShowIllusionShadow(bool show, Color? color = null)
    {
        // 命格没有幻影
    }
    
    public override Spine.TrackEntry PlaySkillAnimation(SkillConfig skillConfig, SkillBase skillBase, bool isCounter, Action onComplete)
    {
        // 命格没有技能动画,立即触发所有帧事件
        int loopCount = skillConfig.LoopCount + 1; //默认会有一次
        int frameCount = skillConfig.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;
    }
    
    public override bool CanStartDeath()
    {
        // 命格不会死亡
        return false;
    }
    
    public override bool CanCastSkillAnimation(SkillConfig skillConfig)
    {
        // 命格总是可以释放技能(从动画角度)
        return true;
    }
    
    public override SkeletonAnimation GetSkeletonAnimation()
    {
        // 命格没有骨骼动画
        return null;
    }
    
    public override void SetSkeletonAlpha(float alpha)
    {
        // 命格没有骨骼动画
    }
 
    // ============ 以下方法命格不需要,但必须实现接口 ============
 
    public override DeathRecordAction Hurt(BattleHurtParam battleHurtParam, SkillRecordAction _parentSkillAction = null)
    {
        // 命格不会被攻击
        Debug.LogWarning("命格不应该被攻击");
        return null;
    }
 
    public override void OnDodgeBegin(DamageType damageType)
    {
        // 命格不需要闪避
    }
 
    public override void OnDodgeEnd(Action _complete = null)
    {
        // 命格不需要闪避
        _complete?.Invoke();
    }
 
    public override void OnDeath(Action _onDeathAnimationComplete, bool withoutAnime = false)
    {
        // 命格没有死亡
        _onDeathAnimationComplete?.Invoke();
    }
 
    protected override BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam)
    {
        // 命格不显示伤害
        return null;
    }
 
    protected override BattleDmgInfo PopDamageForCaster(BattleHurtParam battleHurtParam)
    {
        // 命格不显示伤害
        return null;
    }
 
    public override void HaveRest()
    {
        // 清理 buff
        buffMgr?.RemoveAllBuff();
    }
    
    public override void SetSpeedRatio(float ratio)
    {
        // 命格不需要速度控制
    }
 
    public override void OnObjPropertyRefreshView(HB418_tagSCObjPropertyRefreshView vNetData)
    {
        // 命格没有血量,不需要属性刷新
    }
 
#if UNITY_EDITOR_STOP_USING
    public override void EditorRevive()
    {
        // 命格不需要复活
    }
#endif
 
    protected override void OnPlayHitAnimation()
    {
        // 命格不需要受击动画
    }
}