예제 #1
0
    public void InitializeGame()
    {
        ui.CloseEndGame();

        cardsData.LoadGameData();

        player1.InitializeDeck(cardsPerDeck);
        decks.PopulateDeck(player1.deck, cardsPerDeck, cardsData.cards);
        decks.ShuffleDeck(player1.deck);
        player1.cardFromDeck = 0;
        player1UI.ClearAllSlots();
        player1.health = maxHealth;
        player1UI.UpdateHealthUI(player1.health);

        player2.InitializeDeck(cardsPerDeck);
        decks.PopulateDeck(player2.deck, cardsPerDeck, cardsData.cards);
        decks.ShuffleDeck(player2.deck);
        player2.cardFromDeck = 0;
        player2UI.ClearAllSlots();
        player2.health = maxHealth;
        player2UI.UpdateHealthUI(player2.health);

        gameEnded = false;
        player1.StartTurn();
        turnPlayer1 = true;
        player2.StartTurn();
        turnPlayer2 = true;
    }
예제 #2
0
    public void Attack()
    {
        int damage = 0;

        for (int i = 0; i < ui.slots.Length; i++)
        {
            if (!ui.slots[i].isVoid)
            {
                int value = int.Parse(ui.slots[i].value.text);
                damage += value;
            }
            else
            {
                break;
            }
        }

        enemy.DealDamage(damage, numPlayer);

        ui.ClearAllSlots();
    }