Example #1
0
    /// <summary>
    /// Starts the pass of the pack
    /// </summary>
    /// <returns>If there was cards left to pass</returns>
    public bool PassCardPack()
    {
        SetNewState(PlayerState.Passing);
        if (handCards.Count == 0)
        {
            SetNewState(PlayerState.WaitingToPlay);
            endOfRound = true;
            return(false);
        }
        endOfRound = false;
        if (cardPack == null)
        {
            GameObject gameObj = Instantiate(Deck.Instance().cardPackPrefab, handPosition.transform);
            cardPack = gameObj.GetComponent <CardPack>();
        }
        cardPack.SetCards(handCards);
        Player  neighbor = Deck.Instance().GetNeighbor(this);
        Vector3 targetPosition;

        if (Deck.Instance().PassingLeft())
        {
            cardPack.gameObject.transform.rotation = transform.rotation;
            targetPosition = transform.position;
        }
        else
        {
            cardPack.gameObject.transform.rotation = neighbor.gameObject.transform.rotation;
            targetPosition = neighbor.transform.position;
        }
        cardPack.gameObject.SetActive(true);
        MoveRequest request = new MoveRequest(targetPosition, neighbor.gameObject, this.OnCardPackPassed, 24);

        cardPack.SetMoveRequest(request);
        return(true);
    }
Example #2
0
    /// <summary>
    /// Starts drawing the next turn's card pack from the table
    /// </summary>
    public void DrawCardPack()
    {
        SetNewState(PlayerState.Drawing);
        MoveRequest request = new MoveRequest(handPosition.transform.position, this.gameObject, this.OnCardPackDrawn, 24);

        cardPack = this.GetComponentInChildren <CardPack>();
        cardPack.SetMoveRequest(request);
    }