Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Drawing Cards Idea - Any Good?

Discussion in 'Editor & General Support' started by wisien92, Sep 10, 2014.

  1. wisien92

    wisien92

    Joined:
    Nov 16, 2012
    Posts:
    56
    Hi,
    right now i am thinking of hot to store cards for players.

    Each card has unique ID.

    In lists PlayerHand , PlayerDeck i would store only ID's of cards.

    In game outside of camera i would store all cards and when player draw a card i would instantiate a copy of that card and set it in player hand(of course deleting drawn id's from playerdeck list and adding it to playerhand).


    Does it make any sense or is there a better way of doing this?
     
  2. Chambers

    Chambers

    Joined:
    Apr 4, 2011
    Posts:
    70
    It sounds like it would be fine, storing cards in a proper data structure is something that has been pretty extensively covered. I would recommend looking at how some people tackle the problem when creating Blackjack or Poker games, that should give you an excellent understanding of how to handle storing player drawn cards as well as deck(s) of cards and the cards they contain.

    One example you can find is here; http://www.dreamincode.net/forums/topic/133322-blackjack-in-console-c#/

    Hopefully this helps.