Example #1
0
    public void MarkRandomToBeChanged(bool init)
    {
        int count = 1;

        if (init)
        {
            count = GameRules.ChangingTileCount;
        }

        for (int i = 0; i < count; i++)
        {
            if (changeCount >= GameRules.ChangingTileCount)
            {
                return;
            }
            var filteredList = tiles.FilterCast <Tile>().Where(t => t.type == Tile.TileType.Number && !t.ToBeChanged);
            filteredList.ElementAt(Random.Range(0, filteredList.Count())).MarkToBeChanged();
            changeCount++;
        }
    }