示例#1
0
 public void Recolocate(List <CasillaCursor> casillasToRelocatable)
 {
     for (int i = 0; i < casillasToRelocatable.Count; i++)
     {
         CasillaCursor tmp = tablero[casillasToRelocatable[i].y - 1][casillasToRelocatable[i].x];
         SwitchCasillas(casillasToRelocatable[i], tmp);
     }
 }
示例#2
0
    private void InitCasilla(CasillaCursor cursor, int x, int y)
    {
        int typeCasilla = Random.Range(0, casillasPrefabs.Count);

        cursor.type = typeCasilla;
        cursor.x    = x;
        cursor.y    = y;
        cursor.Done();
    }
示例#3
0
    private void SwitchCasillas(CasillaCursor casilla1, CasillaCursor casilla2)
    {
        int tmpX1 = casilla1.x, tmpY1 = casilla1.y, tmpX2 = casilla2.x, tmpY2 = casilla2.y;

        tablero[casilla2.y][casilla2.x] = casilla1;
        tablero[casilla1.y][casilla1.x] = casilla2;
        casilla1.MoveTo(tmpX2, tmpY2);
        casilla2.MoveTo(tmpX1, tmpY1);
    }
示例#4
0
 public void OnCasillaClickated(CasillaCursor casillaCursor)
 {
     if (firstCasillaCursor == null)
     {
         timeToRelocate     = false;
         timeToCheck        = false;
         firstCasillaCursor = casillaCursor;
     }
     else
     {
         if (!firstCasillaCursor.Equals(casillaCursor))
         {
             SwitchCasillas(firstCasillaCursor, casillaCursor);
         }
         firstCasillaCursor = null;
         timeToRelocate     = true;
     }
 }