I am trying to create a 2d card game. I have a List of cards within a CardStack Class, which is used to push and pop two different card hands (their each CardStack) of five cards. I have been modifying/working off Sloan Kelly’s Black Jack card game tutorial.
I do not know how to C# script a button to push/pop each one of the different cards in the hands?
public class GameController : MonoBehaviour
{
public CardStack player;
public CardStack dealer;
public CardStack deck;
public CardStack makingCard;
public CardStack playingHand;
public CardStack discardPile; #region Unity messages
void Start()
{
StartGame();
} #endregion
public void PlayerPlayingACard()
{
Debug.Log(“you have pressed a button”);
playingHand.Push(player.Pop());
}
void StartGame()
{
for (int i = 0; i < 5; i++)
{
player.Push(deck.Pop());
dealer.Push(deck.Pop());
}
makingCard.Push(deck.Pop());
WhatCard();
HandToArray();
}
I am having problems with attaching a function for UI Buttons which push/pop individual player CardStack cards so the player can pay any of the card. This is a Euchre game.