コード例 #1
0
    public void PlaceCardOnTable(CardView placedCardView, GameObject tableView)
    {
        CardInstance cardToPlace = placedCardView.cardInstance;

        if (cardToPlace.cost <= playerSystem.currentPlayer.value.resources.value)
        {
            if (cardToPlace.card.type != CardType.Spell)
            {
                resourceSystem.WithdrawResources(playerSystem.currentPlayer.value, cardToPlace.cost);
                playerSystem.currentPlayer.Get().hand.Remove(cardToPlace);
                cardToPlace.area = Areas.Table;
                playerSystem.currentPlayer.Get().table.Add(cardToPlace);
                if (cardToPlace.abilityInstance != null && cardToPlace.card.ability is PassiveAbility)
                {
                    Debug.Log("Registering passive ability " + cardToPlace.card.ability.name + " ...");
                    ((PassiveAbilityInstance)cardToPlace.abilityInstance).RegisterAbility();
                }
                new PlaceCardOnTableCommand(placedCardView, tableView.GetComponent <PlayerTableView>()).AddToQueue();
                OnCardPlacedOnTableEvent.Raise();
            }
        }
    }