Пример #1
0
    /// <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);
    }
Пример #2
0
    public override void Explode()
    {
        ErrorHandler.Parse(
            SkillDetails.CreateCreationAround(mBullet.FirerAttr, mBullet.CreationOnArrive, mBullet.GetPosition(), mBullet.GetDirection()),
            "failed to create creature on bullet arrived"
            );

        // 爆炸特效, 仅在子弹到达终点时播放, 即, 子弹没有命中足够的人.
        if (mBullet.CurrentHittedCount < mBullet.MaxHitCount)
        {
            SkillClientBehaviour.AddSceneEffect(mBullet.ExplodeEffect, mBullet.GetPosition(), mBullet.GetDirection());
        }

        // 用碰撞来模拟爆炸, 从而使得技能效果的方向沿着子弹的飞行方向.
        if (mBullet.TargetSelectionOnArrive != uint.MaxValue && mBullet.SkillEffectOnArrive != uint.MaxValue)
        {
            TargetSelectionTableItem targetSel = DataManager.TargetSelectionTable[mBullet.TargetSelectionOnArrive] as TargetSelectionTableItem;

            ArrayList targets = SkillUtilities.SelectTargets(mBullet.FirerAttr, mBullet.GetPosition(), mBullet.GetDirection(), targetSel);

            AttackerAttr other = mBullet.FirerAttr;
            other.SetEffectStartLocation(mBullet.GetPosition(), mBullet.GetDirection());

            foreach (BattleUnit t in targets)
            {
                SkillDetails.AddSkillEffectByResource(other, t, mBullet.SkillEffectOnArrive);
            }
        }
    }
Пример #3
0
    /// <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);
    }