public AttackPlanF(bool set, AttackTypeF Type, List <Route> Routes) { planSet = set; type = Type; routes = Routes; }
public AttackPlanF(bool set, AttackTypeF Type, Vector3 offset) { planSet = set; type = Type; offsetFromEnemy = offset; }
public static AttackPlanF GetAttackPlanF(AttackTypeF type, Vector3 leadPos, Vector3 enemyPos, List <Vector3> nearbyFriendlies) { AttackPlanF attackPlan = new AttackPlanF(true); switch (type) { case AttackTypeF.sentry: float SQRSep = 900f; float sentryRange = 30f; float searchDegrees = 30f; Vector3 offset = (enemyPos - leadPos).normalized * sentryRange; Vector3 sentryPos = enemyPos + offset; List <Vector3> nbfSentryPos = new List <Vector3>(nearbyFriendlies.Count); foreach (Vector3 fv in nearbyFriendlies) { Vector3 fspos = enemyPos + (fv - enemyPos).normalized * sentryRange; nbfSentryPos.Add(fspos); } bool clear = true; int failsafe = 20, i = 1; while (!clear) { foreach (Vector3 fspos in nbfSentryPos) { float SQRDist = (fspos - sentryPos).sqrMagnitude; if (SQRDist < SQRSep) { clear = false; } } if (!clear) { float direction = 1f; if ((i + 1) % 2 == 0) { direction = 1; } else { direction = -1; } direction = direction * i * searchDegrees; offset = NTools.RotateVector3(offset, searchDegrees); sentryPos = enemyPos + offset; } i++; if (i >= failsafe) { clear = true; } } break; case AttackTypeF.bracket: break; case AttackTypeF.charge: break; default: break; } return(attackPlan); }