示例#1
0
 private void Move()
 {
     if (turn == 0 || number <= 0)
     {
     }
     else if (turn == 1)
     {
         if (y != Board.pieceY - 1)
         {
             y++;
         }
     }
     else if (turn == 2)
     {
         if (x != 0)
         {
             x--;
         }
     }
     else if (turn == 3)
     {
         if (y != 0)
         {
             y--;
         }
     }
     else if (turn == 4)
     {
         if (x != Board.pieceX - 1)
         {
             x++;
         }
     }
     else if (turn == 5)
     {
         if (number >= 20)
         {
             number -= 20;
             Board.CreateBase(x, y);
         }
     }
     turn = 0;
     gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2((float)(dx), (float)(dx));
     gameObject.GetComponent <RectTransform>().position  =
         new Vector3((float)((float)(dx * (x)) + bg_x + dx / 2), (float)(dx * (y) + dx / 2), 0);
     Board.ChangeBelong(x, y);
     number_str = number.ToString();
     Text.GetComponent <Text>().text = number_str;
 }