Example #1
0
    public void Start()
    {
        playerManager      = FindObjectOfType <PlayerManager>();
        captionCardManager = FindObjectOfType <CaptionCardManager>();

        card = GetComponentInParent <CaptionCard>();

        voteButton = GetComponent <Button>();
        voteButton.onClick.AddListener(VoteActions);
    }
    public void DrawCards(int amount)
    {
        for (int x = currentDrawPosition; x < (currentDrawPosition + amount); x++)
        {
            CaptionCard card = (deck[x] != "") ? Instantiate(cardPrefab, hand) : Instantiate(blankCardPrefab, hand);
            card.captionText = deck[x];
            card.ShowText();
            card.playerId = PhotonNetwork.player.ID;
        }

        currentDrawPosition = currentDrawPosition + amount;
    }
    public void AddHiddenCardToTable(int playerId, string text)
    {
        CaptionCard card = Instantiate(cardPrefab, tableTop);

        card.playerId    = playerId;
        card.captionText = text;

        if (CheckEveryonePlayedACard())
        {
            ActivateShowTableTopCards();
        }
    }
    public void DeleteCardsFromDisconnectedPlayer(int playerId)
    {
        foreach (Transform gameobject in tableTop)
        {
            CaptionCard card = gameobject.GetComponent <CaptionCard>();

            if (card != null)
            {
                if (card.playerId == playerId)
                {
                    Destroy(gameobject.gameObject);
                }
            }
        }
    }
    private IEnumerator ShowTableTopCards()
    {
        yield return(new WaitForEndOfFrame());

        foreach (Transform gameobject in tableTop)
        {
            CaptionCard card = gameobject.GetComponent <CaptionCard>();

            if (card != null)
            {
                card.ShowText();

                //if(card.playerId != PhotonNetwork.player.ID)
                card.addVoteButton();
            }
        }

        yield return(null);
    }
Example #6
0
    public void OnDrop(PointerEventData eventData)
    {
        CaptionCard drag = eventData.pointerDrag.GetComponent <CaptionCard>();

        if (drag != null)
        {
            if (canDrop)
            {
                drag.parentToReturn = this.transform;
                drag.canDrag        = false;
                captionManager.AddCardToTable(drag.playerId, drag.captionText);
            }

            if (tableTopZone)
            {
                canDrop = false;

                if (captionManager.CheckEveryonePlayedACard())
                {
                    captionManager.ActivateShowTableTopCards();
                }
            }
        }
    }