Card Game Deck Creation UI
Hello, I am trying to make a 3D card game, something like Yugioh Pro or Hearthstone for reference, and was wondering how I would go about making the interface for the user to create their decks. I've been using Unity for a few years now, but this is pretty different from anything I've tried. To be more specific. of a collection of all possible cards in the game , they can click on those cards and they will be added to a Deck. This Deck will can then be saved as something which can be loaded into an actual match. The entirety of coding a card game is pretty foreign to me, but I thought I would break it down a piece at a time and see if I could get somewhere. Thank you in advanced for your help and advice!
Answer by dhaggerfin · Jul 05, 2016 at 05:06 PM
Hey, I'm fairly new to Unity myself, but I'm also starting on a card game. My basic strucure is like this:
1) Backend classes that represent the Cards/Hands in code. So here are the objects I've got:
Card (contains methods to load a card from database, modify various attributes, save a card to database)
Hand (contains Card array + some ordering etc)
Battlefield (contains 2 Hand, 2 Deck objects)
Deck (contains Card array, can be loaded from/saved to database)
ActiveCard (contains a Card + stats that aren't static to the card like "current health" vs "card health")
2) I created a Card prefab object in Unity out of a SpriteRenderer. This renders the base of the card (background, some spots for health/attack/level, etc). Underneath this object i created TextMeshes for placing health text, attack text, card name, etc. Also under the main Card SpriteRenderer I added SpriteRenderers for "number of stars" (it shows 1 to 5 stars directly on the card) and card art.
3) Whenever I click a button during gameplay it will first create a backend "Card" object, instantiate a prefab, and then apply all the texts/arts to the UI version of the card.
I'm still working on it, but I hope that gives an idea to you of one method of implementing a card game.