Esempio n. 1
0
    public bool PlayCardOnCustomer(MoveRequest move)
    {
        if (isGameOver)
        {
            Debug.LogError("Game is over!");
            return(false);
        }

        if (!activeCustomerSet.IsSlotActive(move.customerSlot))
        {
            return(false);
        }

        PlayerState        playerState    = playerGroup.GetPlayerByIndex(move.playerIndex);
        IngredientCardData ingredientData = playerState.hand.GetCard(move.handSlot);
        CustomerCardState  customerState  = activeCustomerSet.GetCustomerByIndex(move.customerSlot);

        if (playerState.cardsPlayed >= PlayerState.kMaxCardsPerTurn)
        {
            return(false);
        }
        if (!customerState.CanAcceptCard(ingredientData))
        {
            return(false);
        }

        _playCard(move, playerState, customerState, ingredientData);

        _playCardEvent();

        return(true);
    }
Esempio n. 2
0
    public void Execute()
    {
        _savedCustomerState = _customerSet.GetCustomerByIndex(_slotIndex);
        _activePlayer.deadCustomerStack.Push(_savedCustomerState.cardData);

        CustomerCardData card = _customerDeck.Pop() as CustomerCardData;

        if (card != null)
        {
            CustomerCardState newState = CustomerCardState.Create(card);
            _customerSet.SetCustomerAtIndex(_slotIndex, newState);
        }
        else
        {
            _customerSet.SetCustomerAtIndex(_slotIndex, null);
        }
    }