using System; using CoreGame; using GAS.Runtime; namespace CoreGame.Render { // 强行掉落, 一般由触发器,触发的指定掉落,凋落物类型一定为技能 [Serializable] public class TaskForceDropItem : InstantAbilityTask { public int dropSkillId; public string dropItemCount; public float dropRadius = BattleConst.DropItemRadius; public override void OnExecute(in TaskSpec self) { var ctx = self.abilitySpec.ctx; if (ctx.castTarget.Count == 0) return; var pos = ctx.castPos[0]; var target = ctx.castTarget[0]; var targetEntity = Contexts.Combat.GetEntity(target); if (targetEntity != null) { var transformProxy = targetEntity.logicTransform; if (transformProxy != null) pos = transformProxy.position; } var count = ExpressionEvaluator.CalcVal_WithCtx(dropItemCount, ctx, 1); for (int i = 0; i < count; i++) { // DropItemSrv.CreateExactDropItem(pos, dropSkillId, dropRadius); } } } }