Пример #1
0
        public bool HandleMovementOrder(ControlGroup Group, ArcenPoint MoveOrderPoint, bool isQueuedCommand)
        {
            ArcenSparseLookup <GameEntity, ArcenPoint> entitiesToPlace;
            GameEntity     coreUnit;
            int            shieldCoverageRadiusOrEquivalent, paddingAroundEachUnit;
            ArcenRectangle firstUnitRect;

            UtilityFunctions_Formation.Helper_FindAndPlaceCoreUnit(Group, MoveOrderPoint, out entitiesToPlace, out coreUnit, out shieldCoverageRadiusOrEquivalent, out paddingAroundEachUnit, out firstUnitRect);

            List <GameEntity> foreZoneEntities, aftZoneEntities;

            UtilityFunctions_Formation.Helper_GetForeAndAftZoneEntities(entitiesToPlace, out foreZoneEntities, out aftZoneEntities);

            bool quadrantExpandsOnXAxis             = false;
            bool quadrantExpandsInPositiveDirection = false;
            int  quadrantMainAxisStart  = firstUnitRect.Top;
            int  quadrantOtherAxisStart = firstUnitRect.CenterX - shieldCoverageRadiusOrEquivalent;
            int  quadrantOtherAxisEnd   = firstUnitRect.CenterX + shieldCoverageRadiusOrEquivalent;

            Helper_DoPlacementWithinProjectedZone(foreZoneEntities, entitiesToPlace, isQueuedCommand, paddingAroundEachUnit,
                                                  quadrantExpandsOnXAxis, quadrantExpandsInPositiveDirection, quadrantMainAxisStart, quadrantOtherAxisStart, quadrantOtherAxisEnd);

            quadrantExpandsInPositiveDirection = true;
            quadrantMainAxisStart = firstUnitRect.Bottom;

            Helper_DoPlacementWithinProjectedZone(aftZoneEntities, entitiesToPlace, isQueuedCommand, paddingAroundEachUnit,
                                                  quadrantExpandsOnXAxis, quadrantExpandsInPositiveDirection, quadrantMainAxisStart, quadrantOtherAxisStart, quadrantOtherAxisEnd);

            UtilityFunctions_Formation.Helper_RotatePointsAccordingToAngleFromCoreUnit(MoveOrderPoint, isQueuedCommand, entitiesToPlace, coreUnit);

            UtilityFunctions_Formation.Helper_ActuallyIssueMoveOrders(isQueuedCommand, entitiesToPlace);

            return(true);
        }
Пример #2
0
 public static void Helper_ActuallyIssueMoveOrders(bool isQueuedCommand, ArcenSparseLookup <GameEntity, ArcenPoint> entitiesToPlace)
 {
     for (int i = 0; i < entitiesToPlace.GetPairCount(); i++)
     {
         ArcenSparseLookupPair <GameEntity, ArcenPoint> pair = entitiesToPlace.GetPairByIndex(i);
         if (pair.Value == ArcenPoint.OutOfRange)
         {
             continue;
         }
         UtilityFunctions_Formation.Helper_SendMoveCommand(pair.Key, pair.Value, isQueuedCommand);
     }
 }
Пример #3
0
        public bool HandleMovementOrder(ControlGroup Group, ArcenPoint MoveOrderPoint, bool isQueuedCommand)
        {
            ArcenSparseLookup <GameEntity, ArcenPoint> entitiesToPlace;
            GameEntity     coreUnit;
            int            shieldCoverageRadiusOrEquivalent, paddingAroundEachUnit;
            ArcenRectangle firstUnitRect;

            UtilityFunctions_Formation.Helper_FindAndPlaceCoreUnit(Group, MoveOrderPoint, out entitiesToPlace, out coreUnit, out shieldCoverageRadiusOrEquivalent, out paddingAroundEachUnit, out firstUnitRect);

            List <GameEntity> foreZoneEntities, aftZoneEntities;

            UtilityFunctions_Formation.Helper_GetForeAndAftZoneEntities(entitiesToPlace, out foreZoneEntities, out aftZoneEntities);

            int occupiedRadius = coreUnit.TypeData.Radius + paddingAroundEachUnit;

            int degreeBufferOnEachEndOfEachArc = 15;
            int arcWidth           = 180 - (degreeBufferOnEachEndOfEachArc * 2);
            int foreArcCenterAngle = 0;
            int aftArcCenterAngle  = foreArcCenterAngle + 180;

            if (Reverse)
            {
                List <GameEntity> temp = foreZoneEntities;
                foreZoneEntities = aftZoneEntities;
                aftZoneEntities  = temp;
            }

            occupiedRadius = Helper_PlaceRings(foreZoneEntities, entitiesToPlace, isQueuedCommand, paddingAroundEachUnit, MoveOrderPoint, occupiedRadius,
                                               NonSimAngleDegrees.Create(foreArcCenterAngle - (arcWidth / 2)), NonSimAngleDegrees.Create(arcWidth));

            // resetting this for the aft arc
            occupiedRadius = coreUnit.TypeData.Radius + paddingAroundEachUnit;

            occupiedRadius = Helper_PlaceRings(aftZoneEntities, entitiesToPlace, isQueuedCommand, paddingAroundEachUnit, MoveOrderPoint, occupiedRadius,
                                               NonSimAngleDegrees.Create(aftArcCenterAngle - (arcWidth / 2)), NonSimAngleDegrees.Create(arcWidth));

            UtilityFunctions_Formation.Helper_RotatePointsAccordingToAngleFromCoreUnit(MoveOrderPoint, isQueuedCommand, entitiesToPlace, coreUnit);

            UtilityFunctions_Formation.Helper_ActuallyIssueMoveOrders(isQueuedCommand, entitiesToPlace);

            return(true);
        }