コード例 #1
0
    public void PlayerGoDown(int n)
    {
        //print("down "+n.ToString());
        //Color mode

        /*for (int times = 0; times < n; times++)
         * {
         *      for (int j = 0; j < Size; j++)
         *      {
         *              for (int i = Size-1; i >0; i--)
         *              {
         *                      buffer[i * Size + j] = buffer[(i-1) * Size + j];
         *              }
         *              buffer[ j] = Random.Range(0, 6);
         *      }
         *
         * }*/
        //flush();

        //Transform mode

        for (int times = 0; times < n; times++)
        {
            for (int j = 0; j < Size; j++)
            {
                Plate tmp = plates[(Size - 1) * Size + j];
                for (int i = Size - 1; i > 0; i--)
                {
                    plates[i * Size + j] = plates[(i - 1) * Size + j];
                }
                plates[j] = tmp;
                tmp.AssignColor(Random.Range(0, 6));
            }
        }
    }
コード例 #2
0
 public void PlayerGoUp(int n)
 {
     /*for (int times = 0; times < n; times++)
      * {
      *      for (int j = 0; j < Size-1; j++)
      *      {
      *              for (int i = 0; i < Size-1; i++)
      *              {
      *                      buffer[i * Size + j] = buffer[(i+1) * Size + j];
      *              }
      *              buffer[(Size-1) * Size + j] = Random.Range(0, 6);
      *      }
      *
      * }*/
     //print("up "+n.ToString());
     for (int times = 0; times < n; times++)
     {
         for (int j = 0; j < Size; j++)
         {
             Plate tmp = plates[j];
             for (int i = 0; i < Size - 1; i++)
             {
                 plates[i * Size + j] = plates[(i + 1) * Size + j];
             }
             plates[(Size - 1) * Size + j] = tmp;
             tmp.AssignColor(Random.Range(0, 6));
         }
     }
     //flush();
 }
コード例 #3
0
 public void PlayerGoRight(int n)
 {
     /*for (int times = 0; times < n; times++)
      * {
      *      for (int i = 0; i < Size; i++)
      *      {
      *              for (int j = 0; j < Size-1; j++)
      *              {
      *                      buffer[i * Size + j] = buffer[i * Size + j + 1];
      *              }
      *              buffer[i * Size + Size - 1] = Random.Range(0, 6);
      *      }
      *
      * }*/
     //flush();
     for (int times = 0; times < n; times++)
     {
         for (int i = 0; i < Size; i++)
         {
             Plate tmp = plates[i * Size];
             for (int j = 0; j < Size - 1; j++)
             {
                 plates[i * Size + j] = plates[i * Size + j + 1];
             }
             plates[i * Size + Size - 1] = tmp;
             tmp.AssignColor(Random.Range(0, 6));
         }
     }
 }