Commit 5cc3dd6b authored by Pascal Biller's avatar Pascal Biller
Browse files

added button to add cards to statistics

parent 7cd27ca3
......@@ -31,6 +31,8 @@ public class BlackJack : MonoBehaviour
int[] playerStates;
int playerCount;
int totalCards;
int value;
char colour;
float sw = 0;
float sh = 0;
bool gameOver = false;
......@@ -77,10 +79,10 @@ public class BlackJack : MonoBehaviour
statsMenu.Update();
lastMousePos = Input.mousePosition;
/*foreach(Transform card in cardsGameObject.transform)
{
card.transform.Rotate(Time.deltaTime * 10, 0, 0);
/*foreach(Transform card in cardsGameObject.transform)
{
card.transform.Rotate(Time.deltaTime * 10, 0, 0);
}*/
}
......@@ -99,6 +101,11 @@ public class BlackJack : MonoBehaviour
isActive = activate;
}
void DrawButtons() {
if(GUI.Button(new Rect(2*sh, viewHeight - 42*sh, 40*sh, 12*sh), "")) {
addCard();
}
if (GUI.Button(new Rect(2*sh, viewHeight - 42*sh, 40*sh, 12*sh), "Add Card", styleBig)) {
}
if(GUI.Button(new Rect(2*sh, viewHeight - 28*sh, 40*sh, 12*sh), "")) {
NextRound();
}
......@@ -197,18 +204,18 @@ public class BlackJack : MonoBehaviour
public void Hit(String card) {
String[] valueColour = card.Split('-');
int value = Int32.Parse(valueColour[0]);
char colour = Char.ToUpper(valueColour[1][0]);
if(currentPlayer<playerCount) {
Hit(value, colour);
} else {
DealerHit(value, colour);
}
value = Int32.Parse(valueColour[0]);
colour = Char.ToUpper(valueColour[1][0]);
}
public void addCard() {
Hit(value, colour);
}
public void Hit(int value, char colour) {
if (!deck.Contains(new Card(value, colour)))
return;
return;
if (!gameOver) {
if (currentPlayer<playerCount) {
......
No preview for this file type
......@@ -246,7 +246,7 @@
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.subsystemregistration": "1.0.5"
"com.unity.subsystemregistration": "1.0.6"
},
"url": "https://packages.unity.com"
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment