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.
61 lines
2.4 KiB
61 lines
2.4 KiB
// using System;
|
|
// using GAS.Runtime;
|
|
// using xFrame;
|
|
//
|
|
// namespace CoreGame.Logic
|
|
// {
|
|
// // 给Bullet挂的GA上才有的task,用于子弹弹射
|
|
// [Serializable]
|
|
// public class TaskBulletBounce : InstantAbilityTask
|
|
// {
|
|
// public int newBulletId;
|
|
//
|
|
// public override void OnExecute(in TaskSpec self)
|
|
// {
|
|
// var ctx = self.abilitySpec.ctx;
|
|
// var owner = ctx.ownerEnt;
|
|
// if (owner.hasBullet == false)
|
|
// {
|
|
// XLog.LogDebug("TaskBulletBounce ctx.ownerEnt is not a bullet");
|
|
// return;
|
|
// }
|
|
// var originBullet = owner.bullet;
|
|
//
|
|
// var caster = Contexts.Combat.GetEntity(originBullet.casterEid);
|
|
// // caster 已死亡
|
|
// if (caster.IsValid() == false)
|
|
// return;
|
|
// // 没有抓取到目标
|
|
// if (ctx.castTarget.Count == 0)
|
|
// return;
|
|
//
|
|
// var bounceBullet = BulletSvc.CreateBounceBullet(caster, ctx, newBulletId);
|
|
// if (bounceBullet == null)
|
|
// {
|
|
// XLog.LogWarning("BounceBullet 创建失败");
|
|
// return;
|
|
// }
|
|
//
|
|
// // 修改属性,弹跳次数减一
|
|
// var originProp = owner.property;
|
|
// var bulletProp = bounceBullet.property;
|
|
// var originBulletBounceCount = (int)originProp.GetProperty(PropertyDef.BulletBounceCount);
|
|
// var originMaxBulletBounceCount = (int)originProp.GetProperty(PropertyDef.MaxBulletBounceCount);
|
|
// originBulletBounceCount--;
|
|
// originProp.SetProperty(PropertyDef.BulletBounceCount, originBulletBounceCount, true);
|
|
// bulletProp.SetProperty(PropertyDef.BulletBounceCount, originBulletBounceCount, true);
|
|
// bulletProp.SetProperty(PropertyDef.MaxBulletBounceCount, originMaxBulletBounceCount, true);
|
|
//
|
|
// if (originBulletBounceCount > 0)
|
|
// {
|
|
// var context = AbilitySrv.GrantTransferAbility(bounceBullet, ctx.abilityId, ctx.abilitySpec.gaInitCfg,
|
|
// null, ctx.level);
|
|
// if (context == null)
|
|
// {
|
|
// XLog.LogWarning("AttachActiveAbility failed: " + ctx.abilityId);
|
|
// return;
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|