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()
|
{
|
}
|
}
|