Add a delay to dealer drawing of cards

master
CrystalMoogle 2023-07-16 16:34:20 +01:00
parent 12b6bb7358
commit 3ae3a26e2b
1 changed files with 13 additions and 3 deletions

View File

@ -8,7 +8,7 @@
Private player As Player
Private dealer As Dealer
Private deck As List(Of Tuple(Of String, String))
Private WithEvents dealerDelay As Timer
Public Sub Start()
Init()
player.Start()
@ -116,14 +116,24 @@
dealer.winType = WinCondition.Bust
player.ingame = False
ElseIf dealer.total < dealer.limit And dealer.hand.Count < 5 Then
DealCard(dealer)
DealerTurn()
dealerDelay = New Timer With {
.Interval = 1000
}
dealerDelay.Start()
Exit Sub
Else
dealer.winType = WinCondition.NormalWin
End If
End If
CheckGame()
End Sub
Sub OnTickDealerDelay(sender As Object, e As EventArgs) Handles dealerDelay.Tick
dealerDelay.Stop()
dealerDelay.Dispose()
DealCard(dealer)
DealerTurn()
End Sub
Sub Hit()
If player.hand.Count < 5 And player.ingame Then
DealCard(player)