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.
46 lines
1.3 KiB
46 lines
1.3 KiB
1 month ago
|
using CoreGame;
|
||
|
using xFrame;
|
||
|
|
||
|
namespace CoreGame.Render
|
||
|
{
|
||
|
public class Trigger_OnShootBouncyBullets : TriggerBase
|
||
|
{
|
||
|
public override void OnEvent(TriggerSpec self, int eventId, object param1)
|
||
|
{
|
||
|
OnTrigger(self, eventId, param1);
|
||
|
}
|
||
|
|
||
|
|
||
|
public override bool OnPreExecuteCheck(TriggerSpec self, int eventId, object param1)
|
||
|
{
|
||
|
if (param1 is not CombatEntity[] bulletEntities)
|
||
|
{
|
||
|
XLog.LogWarning("OnPreExecuteCheck: param1 is not bulletEntities");
|
||
|
return false;
|
||
|
}
|
||
|
var ctx = self.abilitySpec?.ctx;
|
||
|
if (ctx == null)
|
||
|
{
|
||
|
XLog.LogWarning("OnPreExecuteCheck: ctx is null");
|
||
|
return false;
|
||
|
}
|
||
|
ctx.castTarget.Clear();
|
||
|
for (var index = 0; index < bulletEntities.Length; index++)
|
||
|
{
|
||
|
ctx.castTarget.Add(bulletEntities[index].creationIndex);
|
||
|
}
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public override void Init(TriggerSpec self)
|
||
|
{
|
||
|
RegEntityEvent(self, ClientEvent.OnShootBullets);
|
||
|
}
|
||
|
|
||
|
public override void UnInit(TriggerSpec self)
|
||
|
{
|
||
|
UnRegEntityEvent(self, ClientEvent.OnShootBullets);
|
||
|
}
|
||
|
}
|
||
|
}
|