Пример #1
0
        private void CommonLogic(int x, int y, int i, int j)
        {
            Jewel jewel = Jewels[i, j];

            jewel.DestPosition = new Vector2(x * side, y * side);
            tab[x, y]          = jewel.Number;
            tab[i, j]          = -1;
            JewelsToMove.Add(jewel);
            Jewels[x, y] = jewel;
            Jewels[i, j] = null;
        }
Пример #2
0
 public void PopulateGrid()
 {
     playerTouch = true;
     for (int i = 0; i < width; i++)
     {
         for (int j = 0; j < height; j++)
         {
             int random = rnd.Next(numOfJewels);
             tab[i, j] = random;
             Jewel jewel = new Jewel(new Rectangle(i * side, j * side, side, side), Game1.ShardTextures[random], random);
             Jewels[i, j] = jewel;
         }
     }
 }
Пример #3
0
        private void SwapTwoJewels(int X, int Y, int X2, int Y2)
        {
            Jewel jewel1 = Jewels[X, Y];
            Jewel jewel2 = Jewels[X2, Y2];

            jewel1.DestPosition = jewel2.Position;
            jewel2.DestPosition = jewel1.Position;
            Jewels[X, Y]        = jewel2;
            Jewels[X2, Y2]      = jewel1;
            tab[X, Y]           = jewel2.Number;
            tab[X2, Y2]         = jewel1.Number;
            JewelsToMove.Add(jewel1);
            JewelsToMove.Add(jewel2);
        }
Пример #4
0
 private void FillGrid()
 {
     if (GridMoving)
     {
         return;
     }
     for (int i = 0; i < width; i++)
     {
         if (Jewels[i, 0] == null)
         {
             int random = rnd.Next(numOfJewels);
             tab[i, 0]    = random;
             Jewels[i, 0] = new Jewel(new Rectangle(i * side, 0, side, side), Game1.ShardTextures[random], random);
         }
     }
 }