少年修仙传客户端代码仓库
hch
2025-03-03 28785d6ddf9c08e49527ede9405c7b6c93c6ed32
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
using vnxbqy.UI;
using UnityEngine;
using UnityEngine.Events;
 
public class GA_NpcClientFightBoss : GA_NpcClientFightNorm
{
    /// <summary>
    /// 1. 实例ID, 2. Npc表ID
    /// </summary>
    public static UnityAction<uint, int, bool> s_OnSelect;
    /// <summary>
    /// 1. 实例ID, 2. Npc表ID, 3.当前血量, 4. 总血量
    /// </summary>
    public static UnityAction<uint, int, ulong, ulong> s_HpRefresh;
 
    protected sealed override void InitAI()
    {
        // 当为木桩的时候,服务端AI多少不影响,客户端当前绑定了186对人物可以造成真正伤害,后续如果有逻辑需求重新分析使用
        if (NpcConfig.AIType == 186)// 封魔坛boss
        {
            m_AIHandler = new AI_BossFMT(this, BornPos);
        }
        else
        {
            m_AIHandler = new AI_Npc_200(this, BornPos);
        }
    }
 
    public override void OnSelect()
    {
        SelectionManager.Request(SelectionManager.E_Type.Red, this);
 
        if (s_OnSelect != null)
        {
            s_OnSelect(ServerInstID, NpcConfig.NPCID, true);
        }
    }
 
    public sealed override void RequestDialogueBubble()
    {
        if (m_DialogAppear)
        {
            NPCDialogueBubble.Recyle(m_DialogAppear);
        }
    }
 
    protected override sealed void UpdateTimeDialogueBubble()
    {
        if (!MP_Stun)
        {
            return;
        }
 
        // 瞎BB逻辑
        if (Time.realtimeSinceStartup - m_LastTalkTime > 5)
        {
            if (m_DialogTiming != null)
            {
                NPCDialogueBubble.Recyle(m_DialogTiming);
            }
            m_DialogTiming = NPCDialogueBubble.TimingShow(NpcConfig.NPCID, MP_Stun, CameraController.Instance.CameraObject);
            m_LastTalkTime = Time.realtimeSinceStartup;
        }
    }
 
    public override void OnUnSelect()
    {
        SelectionManager.Release(SelectionManager.E_Type.Red);
 
        if (s_OnSelect != null)
        {
            s_OnSelect(ServerInstID, NpcConfig.NPCID, false);
        }
    }
 
    public override void RefreshLifeBar(ulong value)
    {
        if (s_HpRefresh != null)
        {
            s_HpRefresh(ServerInstID, NpcConfig.NPCID, ActorInfo.RealHp, ActorInfo.RealMaxHp);
        }
    }
 
    private float m_LastPlayTime;
 
    public sealed override void PlayHurtAudio(GActorFight attacker)
    {
        base.PlayHurtAudio(attacker);
 
        if (Time.time - m_LastPlayTime > GeneralDefine.PlayBossHurtInterval)
        {
            if (m_AudioSource)
            {
                if (NpcConfig.Sounds != null)
                {
                    if (NpcConfig.Sounds.Length > 1)
                    {
                        SoundPlayer.Instance.PlayAudio(m_AudioSource, NpcConfig.Sounds[1]);
                    }
                }
            }
 
            m_LastPlayTime = Time.time;
        }
    }
 
    #region Boss类型不需要实现的方法, 覆盖掉父类
    public sealed override void RequestLifeBar() { }
    public sealed override void ReleaseLifeBar() { }
    public sealed override void RequestName() { }
    public sealed override void ReleaseName() { }
    #endregion
}