Example #1
0
 internal void MoveCollectionNode(CCPoint movement)
 {
     CollectionNode.PositionX = Constants.Clamp(CollectionNode.PositionX + movement.X, MinX, MaxX);
     CollectionNode.PositionY = Constants.Clamp(CollectionNode.PositionY + movement.Y, MinY, MaxY);
     if (IsHorizontal ? CollectionNode.PositionX == MaxX || CollectionNode.PositionX == MinX : CollectionNode.PositionY == MaxY || CollectionNode.PositionY == MinY)
     {
         Scroller.ScrollVelocity = CCPoint.Zero;
     }
     // update all individual nodes (for scale, zOrder, ...)
     MiddleNode = UpdateNodes();
     Snapped    = false;
 }
Example #2
0
 internal void InitWreckage(List <Aircraft> downedAircrafts)
 {
     if (downedAircrafts.Any())
     {
         Wrecks = downedAircrafts;
         // roll the repair percentages
         var rng = new Random();
         foreach (var aircraft in downedAircrafts)
         {
             float startP = MIN_START_WRECKAGE_PERCENTILE + (float)rng.NextDouble() * (MAX_START_WRECKAGE_PERCENTILE - MIN_START_WRECKAGE_PERCENTILE);
             SetWreckPercentile(aircraft, startP);
             float minEndP = startP + MIN_END_WRECKAGE_BONUS_PERCENTILE;
             WreckMaxPercentile[aircraft] = Constants.Clamp(minEndP + (float)rng.NextDouble() * (MAX_END_WRECKAGE_PERCENTILE - minEndP), minEndP, MAX_END_WRECKAGE_PERCENTILE);
         }
     }
     else
     {
         ReturnToHangar();
     }
 }
Example #3
0
 /// <summary>
 /// WARNING: The movement taken here has to be given in world coordinates.
 /// </summary>
 /// <param name="movement"></param>
 private void MoveCollectionNode(CCPoint movement)
 {
     CollectionNode.PositionX = Constants.Clamp(CollectionNode.PositionX + movement.X, MinX, MaxX);
     CollectionNode.PositionY = Constants.Clamp(CollectionNode.PositionY + movement.Y, MinY, MaxY);
 }