September 2010
Beginner
384 pages
8h 49m
English
This card-flipping code looks pretty good, but there's no way to test it without adding some way of flagging that isFaceUp variable to true. Let's build a new function to do just that, and call it whenever a card button is clicked.
FlipCardFaceUp. As you did with the BuildDeck function earlier, write this function outside of and apart from your other functions make sure it's not trapped inside the curly brackets of one of your other functions.function FlipCardFaceUp()
{
}
FlipCardFaceUp function from inside the card creation code:if(GUILayout.Button(Resources.Load(img), GUILayout.Width(cardW)))
{
FlipCardFaceUp();
Debug.Log(card.img);
}
Read now
Unlock full access