예제 #1
0
    List <Card> mPlayer1Cards;                  //Player 1 list

    // Use this for initialization
    void Start()
    {
        mDeck         = DeckGO.GetComponent <Deck> ();                          //Get Ref to Deck so we can talk to it
        mPrint        = GetComponent <PrintInstructions> ();                    //Get PrintInstructions to Deck so we can talk to it
        mPlayer1Cards = new List <Card> ();                                     //Initialise the list
        mDeck.MakeDeck();                                                       //Make a Deck
        mPrint.ClearText();                                                     //Use Print to print to UI Canvas
        mPrint.AddText(string.Format("Made Deck with {0} cards", mDeck.Count)); //Some Debug
    }
예제 #2
0
    //Modify this code as per workshop instructions

    public void Deal5Cards()
    {
        Card tCard = mDeck.DealCard();

        if (tCard != null)                                                //Will be null if not more cards
        {
            tCard.CardHidden = false;                                     //Show card
            tCard.transform.SetParent(transform);                         //Parent it to this GO, makes Hierachy neater
            tCard.transform.position = Vector2.zero;                      //Put at orgin, if more than 1 card would need to calculate display position
            mPrint.ClearText();                                           //Use Print to print to UI Canvas
            mPrint.AddText(string.Format("{0} cards left", mDeck.Count)); //Some Debug
        }
    }