Exemple #1
0
        public async void Play(MatrixBox matrix_box, Grid gridPlay)
        {
            long[,] matrix = new long[3, 3];
            for (long i = 0; i < 3; ++i)
            {
                for (long j = 0; j < 3; ++j)
                {
                    matrix[i, j] = -1;
                }
            }
            for (long i = 0; i < 3; ++i)
            {
                for (long j = 0; j < 3; ++j)
                {
                    if (i == 2 && j == 2)
                    {
                        break;
                    }
                    matrix[matrix_box.matrix[i, j].curr_row, matrix_box.matrix[i, j].curr_col] = i * 3 + j;
                }
            }
            for (long i = 0; i < 3; ++i)
            {
                for (long j = 0; j < 3; ++j)
                {
                    if (matrix[i, j] == -1)
                    {
                        matrix[i, j] = 8;
                    }
                }
            }

            long _curr = tree[ToInt(matrix)];

            while (_curr != 0)
            {
                long _x = (_curr - 1) % 4;
                MoveEvent.Move(matrix_box, (-1) * X[_x], (-1) * Y[_x]);
                await Task.Delay(500);

                _curr = (_curr - 1) / 4;
            }
            SetGrid.SetDefault(gridPlay);
            SetGrid.SetImage(gridPlay, matrix_box.image);
        }
 void WorldMapContext(Direction direction)
 {
     moveEvent.Move(Character, direction);
 }