少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
using UnityEngine;
 
public class PN_AttackCount : ProcessNode
{
    private int m_AttackCount;
 
    public PN_AttackCount(GA_NpcClientFightNorm npcFight, int count)
    {
        m_Target = npcFight;
        m_AttackCount = 0;
        intParam = count;
    }
 
    public override void Init()
    {
        m_Target.OnAttackObj += OnAttackObj;
 
#if UNITY_EDITOR
        if (RuntimeLogUtility.s_LogProcessInfo)
        {
            Debug.LogFormat("开始检测NPC攻击次数, 需要攻击: {0} 次");
        }
#endif
    }
 
    private void OnAttackObj(uint sid, int skillId)
    {
        m_AttackCount += 1;
#if UNITY_EDITOR
        if (RuntimeLogUtility.s_LogProcessInfo)
        {
            Debug.LogFormat("NPC攻击次数: {0} 次", m_AttackCount);
        }
#endif
    }
 
    public override bool IsOver()
    {
        return m_AttackCount >= intParam;
    }
 
    public override void UnInit()
    {
        m_Target.OnAttackObj -= OnAttackObj;
    }
 
    public override void Update()
    {
    }
}