Пример #1
0
    public TargetCollection CalculateSingleTarget(BattleUnit caster, AbilityData abilityData, RequestTarget requestTarget, ActionTarget actionTarget)
    {
        var targetCollection = new TargetCollection();

        if (actionTarget.singTarget == ActionSingTarget.CASTER)
        {
            targetCollection.targetType = AbilityRequestTargetType.UNIT;
            targetCollection.AddUnit(caster);
            return(targetCollection);
        }

        if (requestTarget == null)
        {
            BattleLog.LogError("单体技能[{0}]的单体目标配置非CASTER,但是请求的目标为nil", abilityData.configFileName);
            return(null);
        }

        if (actionTarget.singTarget == ActionSingTarget.TARGET)
        {
            if (requestTarget.targetType == AbilityRequestTargetType.POINT)
            {
                BattleLog.LogError("单体技能[{0}]目标配置为TARGET,REQUEST TARGET却是POINT类型", abilityData.configFileName);
                return(null);
            }

            targetCollection.targetType = AbilityRequestTargetType.UNIT;
            targetCollection.AddUnit(requestTarget.GetTargetUnit());
            return(targetCollection);
        }

        if (actionTarget.singTarget == ActionSingTarget.POINT)
        {
            targetCollection.targetType = AbilityRequestTargetType.POINT;
            targetCollection.AddPoint(requestTarget.targetPos);
            return(targetCollection);
        }

        BattleLog.LogError("技能[{0}]中有未实现的目标类型[{1}]", abilityData.configFileName);
        return(null);
    }