コード例 #1
0
    public override void ExecuteCommand()
    {
        CardOnBoardController newCardOnBoard = new CardOnBoardController(Player, Card.cardAsset);

        Player.PlayerHealth += newCardOnBoard.cardAsset.cardHealth;

        if (ChosenRow == 0)
        {
            Player.frontRow.CardsOnFrontRow.Insert(RowPosition, newCardOnBoard);
        }
        else
        {
            Player.backRow.CardsOnBackRow.Insert(RowPosition, newCardOnBoard);
        }

        if (newCardOnBoard.abilityToBeExecuted != null)
        {
            newCardOnBoard.abilityToBeExecuted.WhenCardPlayed();
        }

        Player.hand.CardsInHand.Remove(Card);

        if (GameManager.IsHeadlessMode == false)
        {
            HandView   PlayerHand = Player.playerView.handView;
            GameObject card       = IDHolder.GetGameObjectWithID(Card.ID);
            PlayerHand.RemoveCard(card);
            HoverPreview.PreviewsAllowed = true;
            if (ChosenRow == 0)
            {
                Player.playerView.frontRowView.AddCardAtIndex(Card.cardAsset, newCardOnBoard.ID, RowPosition);
            }
            else
            {
                Player.playerView.backRowView.AddCardAtIndex(Card.cardAsset, newCardOnBoard.ID, RowPosition);
            }

            newCardOnBoard.cardOwner.playerView.playerHealth.playerHealth.text = newCardOnBoard.cardOwner.PlayerHealth.ToString();

            new DestroyObjectCommand(card).AddToQueue();
        }
        CommandExecutionComplete();
    }
コード例 #2
0
    //TODO: Some behaviours can move to PileController
    protected virtual void CollectCard(Card card)
    {
        Hand     hand     = Player.Hand;
        HandView handView = PlayerView.HandView;
        Pile     pile     = pileController.Pile;

        hand.Remove(card);
        handView.RemoveCard(card);

        if (pile.CanCollected(card))
        {
            Player.CollectedCards += pile.Count;
            byte collectScore = pileController.Collect(card);
            AddScore(collectScore);
        }
        else
        {
            pileController.AddCard(card);
        }

        pile.IsBusy = false;
        GameManager.Instance.NextTurn();
    }