Prechádzať zdrojové kódy

Merge pull request #1445 from KellyThomas/patch-1

use `await ToSignal()` for game over timing
Max Hilbrunner 7 rokov pred
rodič
commit
a6bbf1cece

+ 2 - 4
getting_started/step_by_step/your_first_game.rst

@@ -968,14 +968,12 @@ temporarily, such as "Get Ready". On the ``MessageTimer``, set the
 
 
     async public void ShowGameOver()
     async public void ShowGameOver()
     {
     {
-        ShowMessage("Game Over");
-    
         var startButton = (Button) GetNode("StartButton");
         var startButton = (Button) GetNode("StartButton");
         var messageTimer = (Timer) GetNode("MessageTimer");
         var messageTimer = (Timer) GetNode("MessageTimer");
         var messageLabel = (Label) GetNode("MessageLabel");
         var messageLabel = (Label) GetNode("MessageLabel");
 
 
-        //work around for gdscript's yield
-        await Task.Delay((int) messageTimer.WaitTime * 1000);
+        ShowMessage("Game Over");
+        await ToSignal(messageTimer, "timeout");
         messageLabel.Text = "Dodge the\nCreeps!";
         messageLabel.Text = "Dodge the\nCreeps!";
         messageLabel.Show();
         messageLabel.Show();
         startButton.Show();
         startButton.Show();