Exemplo n.º 1
0
 private void MovePieces()
 {
     if ((swipeAngle >= -45 && swipeAngle < 45) && column < board.width - 1)
     {
         otherDot = board.allDots[column + 1, row];
         if (otherDot != null && otherDot.tag != board.coldTile.tag)
         {
             previousColumn = column;
             previousRow    = row;
             otherDot.GetComponent <Dot>().column -= 1;
             column += 1;
             if (SceneManager.GetActiveScene().name == "lvl04" || SceneManager.GetActiveScene().name == "lvl09" ||
                 SceneManager.GetActiveScene().name == "lvl14" || SceneManager.GetActiveScene().name == "lvl19" ||
                 SceneManager.GetActiveScene().name == "lvl24")
             {
                 stepManager.DecreaseCounter(1);
             }
             StartCoroutine(CheckMoveCo());
         }
         else
         {
             board.currentState = GameState.move;
         }
     }
     else if ((swipeAngle >= 45 && swipeAngle < 135) && row < board.height - 1)
     {
         otherDot = board.allDots[column, row + 1];
         if (otherDot != null && otherDot.tag != board.coldTile.tag)
         {
             previousColumn = column;
             previousRow    = row;
             otherDot.GetComponent <Dot>().row -= 1;
             row += 1;
             if (SceneManager.GetActiveScene().name == "lvl04" || SceneManager.GetActiveScene().name == "lvl09" ||
                 SceneManager.GetActiveScene().name == "lvl14" || SceneManager.GetActiveScene().name == "lvl19" ||
                 SceneManager.GetActiveScene().name == "lvl24")
             {
                 stepManager.DecreaseCounter(1);
             }
             StartCoroutine(CheckMoveCo());
         }
         else
         {
             board.currentState = GameState.move;
         }
     }
     else if ((swipeAngle >= 135 || swipeAngle < -135) && column > 0)
     {
         otherDot = board.allDots[column - 1, row];
         if (otherDot != null && otherDot.tag != board.coldTile.tag)
         {
             previousColumn = column;
             previousRow    = row;
             otherDot.GetComponent <Dot>().column += 1;
             column -= 1;
             if (SceneManager.GetActiveScene().name == "lvl04" || SceneManager.GetActiveScene().name == "lvl09" ||
                 SceneManager.GetActiveScene().name == "lvl14" || SceneManager.GetActiveScene().name == "lvl19" ||
                 SceneManager.GetActiveScene().name == "lvl24")
             {
                 stepManager.DecreaseCounter(1);
             }
             StartCoroutine(CheckMoveCo());
         }
         else
         {
             board.currentState = GameState.move;
         }
     }
     else if ((swipeAngle < -45 && swipeAngle >= -135) && row > 0)
     {
         otherDot = board.allDots[column, row - 1];
         if (otherDot != null && otherDot.tag != board.coldTile.tag)
         {
             previousColumn = column;
             previousRow    = row;
             otherDot.GetComponent <Dot>().row += 1;
             row -= 1;
             if (SceneManager.GetActiveScene().name == "lvl04" || SceneManager.GetActiveScene().name == "lvl09" ||
                 SceneManager.GetActiveScene().name == "lvl14" || SceneManager.GetActiveScene().name == "lvl19" ||
                 SceneManager.GetActiveScene().name == "lvl24")
             {
                 stepManager.DecreaseCounter(1);
             }
             StartCoroutine(CheckMoveCo());
         }
         else
         {
             board.currentState = GameState.move;
         }
     }
     else
     {
         board.currentState = GameState.move;
     }
 }