protected override void SpecialPath(ManagerHelper mH) { var temp = (Conquest)mH.GetGametype(); ConquestBase forwardBase = temp.GetForwardBase(affiliation, mH); if (forwardBase != null) { mH.GetPathHelper().FindClearPath(GetOriginPosition(), forwardBase.GetOriginPosition(), mH, path); } else { EngagePath(mH); } }
public ConquestBase GetForwardBase(NPC.AffliationTypes a, ManagerHelper mH) { ConquestBase fb = null; if (GetNumAlliedBases(a) != 0 && GetNumAlliedBases(a) != winScore) { ConquestBase closestToFB = null; float distanceToClosestToFB = float.PositiveInfinity; foreach (ConquestBase b in GetBases()) { if (b.affiliation == a) { ConquestBase closestToB = null; float distanceToClosestToB = float.PositiveInfinity; foreach (ConquestBase conquestBase in GetBases()) { if (conquestBase.affiliation != b.affiliation) { float distanceToNewEnemy = PathHelper.DistanceSquared(conquestBase.GetOriginPosition(), b.GetOriginPosition()); if (distanceToNewEnemy < distanceToClosestToB) { distanceToClosestToB = distanceToNewEnemy; closestToB = conquestBase; } } } if (distanceToClosestToB < distanceToClosestToFB) { distanceToClosestToFB = distanceToClosestToB; closestToFB = closestToB; fb = b; } } } } return(fb); }
protected override void SpecialPath(ManagerHelper mH) { var temp = (Conquest)mH.GetGametype(); ConquestBase targetBase = null; float distanceToClosest = float.PositiveInfinity; foreach (ConquestBase conquestBase in temp.GetBases()) { if (conquestBase.affiliation != affiliation) { float distanceToBase = PathHelper.DistanceSquared(GetOriginPosition(), conquestBase.GetOriginPosition()); if (distanceToBase < distanceToClosest) { distanceToClosest = distanceToBase; targetBase = conquestBase; } } } if (targetBase != null) { if (PathHelper.DistanceSquared(GetOriginPosition(), targetBase.GetOriginPosition()) > 32 * 32) { mH.GetPathHelper().FindClearPath(GetOriginPosition(), targetBase.GetOriginPosition(), mH, path); } else { HoverPath(mH, targetBase.GetOriginPosition(), 32); } } else { EngagePath(mH); } }
public ConquestBase GetClosestInList(List <ConquestBase> bL, Vector2 p) { if (bL.Count > 0) { ConquestBase closest = null; float minDist = float.PositiveInfinity; foreach (ConquestBase b in bL) { float aDist = PathHelper.DistanceSquared(p, b.GetOriginPosition()); if (aDist < minDist) { closest = b; minDist = aDist; } } return(closest); } return(null); }