Пример #1
0
 public bool targetCanGoingDown(ATetrimino target)
 {
     List<Block> shapes = target.getBlocks();
     foreach (Block b in shapes)
     {
         if (target.PosRel.Y + b.PosRel.Y > Constants.Measures.boardBlockHeight - 2)
             return false;
         if (board.isBusyCase(new Vector2(target.PosRel.X + b.PosRel.X, target.PosRel.Y + b.PosRel.Y + 1)))
             return false;
     }
     return true;
 }
Пример #2
0
 public bool pushBlocks(ATetrimino t, Rectangle climbyDeadZone)
 {
     bool ret = false;
     updatedLine = new HashSet<int>();
     List<Block> blocks = t.getBlocks();
     int tx = (int)t.PosRel.X;
     int ty = (int)t.PosRel.Y;
     float min = blocks[0].PosRel.Y + ty;
     camUp = 0;
     foreach (Block b in blocks)
     {
         b.setHitBoxValue((int)((b.PosRel.X + tx) * Constants.Measures.blockSize + CoordHelper.Instance.getLeftMargin(playerType)),
                          (int)((b.PosRel.Y + ty) * Constants.Measures.blockSize + Constants.Measures.upBoardMargin));
         if (climbyDeadZone.Intersects(b.HitBox))
             ret = true; // DEATH
         grid[(int)(b.PosRel.Y + ty)][(int)(b.PosRel.X + tx)] = b;
         updatedLine.Add((int)(b.PosRel.Y + ty));
         if (min > b.PosRel.Y + ty)
             min = b.PosRel.Y + ty;
     }
     camUp = (int)((Constants.Measures.boardBlockHeight / 2 - 2) - min);
     return ret;
 }