Exemplo n.º 1
0
        /// <summary>
        /// Given an array of combatants, filters out those who aren't valid targets for the given targeting parameters.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="availableTargets"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static StratusCombatController[] FilterTargets(StratusCombatController source, StratusCombatController[] availableTargets, StratusCombatTarget type)
        {
            StratusCombatController[] targets = null;

            switch (type)
            {
            case StratusCombatTarget.Self:
                targets = new StratusCombatController[1] {
                    source
                };
                break;

            case StratusCombatTarget.Ally:
                targets = (from StratusCombatController target in availableTargets where source.GetTargetRelation(target) == StratusCombatTargetRelation.Friendly select target).ToArray();
                break;

            case StratusCombatTarget.Enemy:
                targets = (from StratusCombatController target in availableTargets where source.GetTargetRelation(target) == StratusCombatTargetRelation.Hostile select target).ToArray();
                break;

            case StratusCombatTarget.Any:
                targets = availableTargets;
                break;

            default:
                break;
            }

            return((from StratusCombatController controller in targets where controller.state == StratusCombatController.State.Active select controller).ToArray());
        }
Exemplo n.º 2
0
 public override StratusCombatController[] EvaluateTargets(StratusCombatController caster, StratusCombatController[] targets, StratusCombatTarget type)
 {
     return(FilterTargets(caster, targets, type).Where(x => Vector3.Distance(x.transform.position, caster.transform.position) <= this.range).ToArray());
 }
Exemplo n.º 3
0
 /// <summary>
 /// Evaluates a list of possible targets according to this targeting model
 /// </summary>
 /// <param name="caster"></param>
 /// <param name="target"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public abstract StratusCombatController[] EvaluateTargets(StratusCombatController caster, StratusCombatController[] targets, StratusCombatTarget type);
 protected abstract CombatController[] FindTargets <CombatController>(CombatController source, StratusCombatTarget parameters, float radius);