Exemplo n.º 1
0
    public BattleUnit FindTargetUnitByAbility(BattleUnit caster, Ability ability)
    {
        // 全屏技能
        if (ability.GetCastRange() <= 0)
        {
            return(caster);
        }

        BattleUnit          lastTarget       = caster.target;
        MultipleTargetsTeam targetTeam       = ability.GetTargetTeam();
        MultipleTargetsType targetDemageType = ability.GetDamageType();

        BattleUnit newTarget;

        if (lastTarget == null || lastTarget.IsUnSelectable())
        {
            BattleCamp        sourceCamp = caster.camp;
            List <BattleUnit> targets    = FindTargetUnits(caster, targetTeam, targetDemageType);
            newTarget = FilterTargetEntityFromList(caster, ability, targets);
        }
        else
        {
            newTarget = lastTarget;
        }
        return(newTarget);
    }
Exemplo n.º 2
0
    private List <BattleUnit> FindTargetUnits(BattleUnit caster, MultipleTargetsTeam targetTeam, MultipleTargetsType targetDemageType)
    {
        List <BattleUnit> targets = new List <BattleUnit>(0);

        // 根据阵营找对象
        BattleCamp sourceCamp = caster.camp;

        if (targetTeam == MultipleTargetsTeam.UNIT_TARGET_TEAM_FRIENDLY)
        {
            targetTeam = sourceCamp == BattleCamp.FRIENDLY ? MultipleTargetsTeam.UNIT_TARGET_TEAM_FRIENDLY : MultipleTargetsTeam.UNIT_TARGET_TEAM_ENEMY;
        }
        else if (targetTeam == MultipleTargetsTeam.UNIT_TARGET_TEAM_ENEMY)
        {
            targetTeam = sourceCamp == BattleCamp.FRIENDLY ? MultipleTargetsTeam.UNIT_TARGET_TEAM_ENEMY : MultipleTargetsTeam.UNIT_TARGET_TEAM_FRIENDLY;
        }

        switch (targetTeam)
        {
        case MultipleTargetsTeam.UNIT_TARGET_TEAM_ENEMY:
            InsertToTargetList(BattleUnitManager.instance.GetEntities(BattleCamp.ENEMY), targets);
            break;

        case MultipleTargetsTeam.UNIT_TARGET_TEAM_FRIENDLY:
            InsertToTargetList(BattleUnitManager.instance.GetEntities(BattleCamp.FRIENDLY), targets);
            break;

        case MultipleTargetsTeam.UNIT_TARGET_TEAM_BOTH:
            InsertToTargetList(BattleUnitManager.instance.GetEntities(BattleCamp.ENEMY), targets);
            InsertToTargetList(BattleUnitManager.instance.GetEntities(BattleCamp.FRIENDLY), targets);
            break;

        default:
            break;
        }
        return(targets);
    }
Exemplo n.º 3
0
 public void SetTargetTeam(MultipleTargetsTeam value)
 {
     Teams = value;
 }