Exemplo n.º 1
0
        public void ShuffleTileStack()
        {
            if (_allTilesWithoutSpecial.Count == 0)
            {
                Debug.LogError($"Tile stack is empty! Run {nameof(GenerateTileStack)} first");
            }
            var tilesToShuffle = _allTilesWithoutSpecial.ToArray();

            for (int i = 0; i < TIMES_TO_SHUFFLE; i++)
            {
                FisherYatesShuffle.ShuffleSequence(tilesToShuffle);
            }
            _allTilesWithoutSpecial = new List <TileData>(tilesToShuffle);
            if (!string.IsNullOrEmpty(_specialTileName) && _specialTilePosition > 0)
            {
                AddSpecialTileAtPosition(_specialTileName, _specialTilePosition);
            }
            AddTilesToStack();
        }