/// <summary> /// 以目标选择的对象(而不是资源ID)作为参数, 外界可以通过直接构造该对象, 而非从数据表读取, 从而调用该方法. /// </summary> public static ErrorCode SelectTargetAndAddSkillEffect( AttackerAttr attackerAttr, Vector3 centerPosition, float direction, TargetSelectionTableItem targetSelectionRes, uint skillEffectResID, SkillUtilities.FilterTarget filter = null ) { ArrayList targets = SkillUtilities.SelectTargets(attackerAttr, centerPosition, direction, targetSelectionRes); if (filter != null) { SkillUtilities.FilterTargetsBy(targets, filter, null); } foreach (BattleUnit t in targets) { // 设置效果的起始点. attackerAttr.SetEffectStartLocation(centerPosition, Utility.Vector3ToRadian(t.GetPosition() - attackerAttr.EffectStartPosition, direction) ); ErrorHandler.Parse( AddSkillEffectByResource(attackerAttr, t, skillEffectResID), "failed to add skill effect with SelectTargetAndAddSkillEffect" ); } return(ErrorCode.Succeeded); }
/// <summary> /// 从graphCenter, 沿dirRadian方向, 通过targetSel选择目标, 并给选择到的目标添加skillEffectID标识的技能效果. /// </summary> /// <returns>命中目标个数</returns> private uint collideAt(Vector3 graphCenter, float dirRadian, TargetSelectionTableItem targetSel, uint skillEffectID) { ArrayList targets = SkillUtilities.SelectTargets(mFirerAttr, graphCenter, dirRadian, targetSel); SkillUtilities.FilterTargetsBy(targets, checkHitObject); AttackerAttr other = mFirerAttr; other.SetEffectStartLocation(graphCenter, dirRadian); foreach (BattleUnit t in targets) { SkillDetails.AddSkillEffectByResource(other, t, skillEffectID); } return((uint)targets.Count); }