public void SetupGame() { // Get a reference to the card database CSVScriptReader database = FindObjectOfType <CSVScriptReader>(); List <Card> cardDatabase = database.GetCards(); // Get a reference to the GameDatabase GameSettings gameDatabase = FindObjectOfType <GameSettings>(); // Go over each card in the database for (int i = 0; i < cardDatabase.Count; i++) { // Go over each chosen tag for (int j = 0; j < addedTags.Count; j++) { // If the tag is the same as the one on the card in the database .. if (cardDatabase[i].culture == addedTags[j]) { // .. Then add the card to the gamedatabase gameDatabase.AddCard(cardDatabase[i]); } } } // Set the gamemode //gameDatabase.SetGamemode(dropdown.options[dropdown.value].text); }
public void SetupCards() { // If there are no cards in the current game then add some if (gameDatabase.GetSingleGameCardDatabase() == null || gameDatabase.GetSingleGameCardDatabase().Count <= 0) { // If there is no object holding the whole database then .. if (FindObjectOfType <CSVScriptReader>() == null) { // .. create a new database CreateCardDatabase(); } // And add a maximum of 10 dummy cards to the game List <Card> backupCards = FindObjectOfType <CSVScriptReader>().GetCards(); int cardsAdded = 10; if (backupCards.Count <= 10) { cardsAdded = backupCards.Count; } // Add the cards to the database for (int i = 0; i < cardsAdded; i++) { gameDatabase.AddCard(backupCards[i]); } } // Depending on the gamemode setup the cards differently if (currentGamemode == gamemode.cards) { SetupCardsOnlyDeck(); } else if (currentGamemode == gamemode.rollingCube) { SetupRollingCubeDeck(); } }