public TargetDirections DirectionType; // direction for cone and dest targets public StaticTargetData(TargetObjects objectType, TargetReferences referenceType, TargetSelections selectionCategory, TargetChecks selectionCheckType, TargetDirections directionType) { ObjectType = objectType; ReferenceType = referenceType; SelectionCategory = selectionCategory; SelectionCheckType = selectionCheckType; DirectionType = directionType; }
public static void SearchAreaTargets(List <Unit> targets, float radius, Vector3 center, Unit referer, TargetChecks checkType) { Collider[] hitColliders = Physics.OverlapSphere(center, radius, 1 << LayerMask.NameToLayer("Characters")); for (int i = 0; i < hitColliders.Length; i++) { var targetUnit = hitColliders[i].gameObject.GetComponent <Unit>(); if (targetUnit == null) { continue; } switch (checkType) { case TargetChecks.ALLY: if (referer.IsHostileTo(targetUnit)) { continue; } break; case TargetChecks.ENEMY: if (!referer.IsHostileTo(targetUnit)) { continue; } break; default: break; } targets.Add(targetUnit); } }