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.
37 lines
1.2 KiB
37 lines
1.2 KiB
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);
|
|
}
|
|
}
|
|
}
|
|
}
|