Ejemplo n.º 1
0
    /// <summary>
    /// Used for cards to attack other cards.
    /// </summary>
    public void AttackedAnotherCard(CardButton button)
    {
        // Checks if the player is allowed to attack.
        if(button.associatedPlayer != currentPlayer)
        {
            // Makes the second card get attacked the amount of the first one.
            selectedCard.hasAttacked = true;
            selectedCard.associatedCard.PlayCard();
            canvasManager.cursor.ChangeCursor(0);
            particles.transform.position = button.transform.position;
            particles.Play();

            // Does damage to the first card.
            int attackDealt = selectedCard.associatedCard.ReturnAttack();
            int damageDealt = button.associatedCard.ReturnAttack();
            selectedCard.GetDamage(damageDealt);
            button.GetDamage(attackDealt);

            // Updates the selected card's health.
            selectedCard = null;
        }
    }