// using System; // using GAS.Runtime; // using xFrame; // // namespace CoreGame.Render // { // // 给持枪人触发的Task, 给发射的子弹添加可弹射的天赋,并初始化可弹射次数 // [Serializable] // public class TaskMakeBulletsBouncy : InstantAbilityTask // { // public int abilityId; // public string bounceCountStr; // // public override void OnExecute(in TaskSpec self) // { // var ctx = self.abilitySpec.ctx; // var bulletEntities = ctx.castTarget; // var bounceCount = ExpressionEvaluator.CalcVal_WithCtx(bounceCountStr, ctx); // for (var index = 0; index < bulletEntities.Count; index++) // { // var bulletEnt = Contexts.Combat.GetEntity(bulletEntities[index]); // if (bulletEnt == null) // { // XLog.LogWarning("bulletEnt is null"); // return; // } // var context = AbilitySrv.GrantTransferAbility(bulletEnt, abilityId, ctx.abilitySpec.gaInitCfg, null, ctx.level); // if (context == null) // { // XLog.LogWarning("AttachActiveAbility failed: " + abilityId); // return; // } // // bulletEnt.property.SetProperty(PropertyDef.BulletBounceCount, bounceCount, true); // bulletEnt.property.SetProperty(PropertyDef.MaxBulletBounceCount, bounceCount, true); // } // } // } // }