Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Privacy
Imprint
Contact
Login methods
Sign in
Toggle navigation
Menu
Open sidebar
Alex Ochs
AR Poker
Commits
5cc3dd6b
Commit
5cc3dd6b
authored
Jul 16, 2021
by
Pascal Biller
Browse files
added button to add cards to statistics
parent
7cd27ca3
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Assets/Scripts/BlackJack.cs
View file @
5cc3dd6b
...
...
@@ -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
)
{
...
...
Assets/TextMesh Pro/Examples & Extras/Resources/Fonts & Materials/Roboto-Bold SDF.asset
View file @
5cc3dd6b
This diff is collapsed.
Click to expand it.
BlackJack.apk
View file @
5cc3dd6b
No preview for this file type
Packages/packages-lock.json
View file @
5cc3dd6b
...
...
@@ -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"
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment