using System; public class PN_BeAttackCount : ProcessNode { private int m_BeAttackCount = 0; public PN_BeAttackCount(GA_NpcClientFightNorm npc, int beAttackCount) { m_BeAttackCount = 0; m_Target = npc; intParam = beAttackCount; } public sealed override void Init() { m_Target.OnAttacked += OnBeAttacked; #if UNITY_EDITOR if (RuntimeLogUtility.s_LogProcessInfo) { UnityEngine.Debug.LogFormat("开始计算被攻击次数"); } #endif } private void OnBeAttacked() { m_BeAttackCount += 1; #if UNITY_EDITOR if (RuntimeLogUtility.s_LogProcessInfo) { UnityEngine.Debug.LogFormat("被攻击次数: {0}", m_BeAttackCount); } #endif } public sealed override bool IsOver() { return m_BeAttackCount >= intParam; } public sealed override void UnInit() { m_Target.OnAttacked -= OnBeAttacked; #if UNITY_EDITOR if (RuntimeLogUtility.s_LogProcessInfo) { UnityEngine.Debug.LogFormat("被攻击检测节点结束"); } #endif } public sealed override void Update() { } }