You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.6 KiB
57 lines
1.6 KiB
using CoreGame;
|
|
|
|
namespace CoreGame.Render
|
|
{
|
|
public class Trigger_HeadShot : TriggerBase
|
|
{
|
|
// 暴头触发
|
|
// p2, 是否击杀
|
|
public override void OnEvent(TriggerSpec self, int eventId, object param1)
|
|
{
|
|
if (triggerCfg.param2 != 0)
|
|
{
|
|
var hurtData = (HurtData)param1;
|
|
var currHp = hurtData.dst.property.GetProperty_Long(PropertyDef.CurHp);
|
|
var ret = 2; // 未击杀
|
|
if (currHp <= 0)
|
|
ret = 1; // 击杀
|
|
|
|
if ((triggerCfg.param2 & (1 << (ret - 1))) == 0)
|
|
return;
|
|
}
|
|
|
|
//OnTrigger(self, eventId, param1);
|
|
var cntAcc = triggerCfg.param1; // 累计
|
|
self.param1.intVal += 1; // 累计
|
|
if (self.param1.intVal < cntAcc)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var isSucc = OnTrigger(self, eventId, param1);
|
|
if (isSucc)
|
|
{
|
|
self.param1.intVal = 0;
|
|
}
|
|
}
|
|
|
|
public override bool OnPreExecuteCheck(TriggerSpec self, int eventId, object param1)
|
|
{
|
|
if (triggerCfg.param4 != 0)
|
|
{
|
|
TriggerSrv.AssembleTriggerAbilitySpecCtx(self, (HurtData)param1);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override void Init(TriggerSpec self)
|
|
{
|
|
RegEntityEvent(self, ClientEvent.OnHeadShotHit);
|
|
}
|
|
|
|
public override void UnInit(TriggerSpec self)
|
|
{
|
|
UnRegEntityEvent(self, ClientEvent.OnHeadShotHit);
|
|
}
|
|
}
|
|
}
|