예제 #1
0
        //***********************************************************************
        //************************** Internal Methods ***************************
        //***********************************************************************

        private void AddTile(Tile tile)
        {
            tile.SetOwner(_accessKey);
            Tiles.Add(tile);
            //Set tile rendering orientation
            handRenderer.UpdateOrientation(tile);
        }
예제 #2
0
        //***********************************************************************
        //******************************* Shuffling *****************************
        //***********************************************************************

        //Shuffles the tile at the specified index into a random location over a range
        private void ShuffleTile(int index, int low, int high)
        {
            Tile placeholder = new Tile();

            placeholder.SetOwner(_accessKey);
            placeholder.Set(TileID.Suits.Kaze, 0);

            Tile shuffling = Tiles[index];

            //Use placeholder to not mess up the range
            Tiles[index] = placeholder;
            System.Random rnd = new System.Random();
            int           to  = rnd.Next(low, high);

            Tiles.Insert(to, shuffling, _accessKey);
            Tiles.Remove(placeholder, _accessKey);
        }
예제 #3
0
        //Performs an in-place swap of two tiles
        private void Swap2(int i, int j)
        {
            if (i == j)
            {
                return;
            }

            Tile placeholder = new Tile();

            placeholder.SetOwner(_accessKey);
            placeholder.Set(TileID.Suits.Kaze, 0);

            Tile wasi = Tiles[i];
            Tile wasj = Tiles[j];

            Tiles[j] = placeholder;
            Tiles[i] = wasj;
            Tiles[j] = wasi;
        }