Last active
February 15, 2018 21:22
-
-
Save polerin/4cfae71a327a3767e2162938a9220e0f to your computer and use it in GitHub Desktop.
First time StartRound() is called, everything flows through correctly, including waiting the correct amount of time. Second time, it flows through to the await, but that never returns from the await.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Blah { | |
public class RoundManager { | |
// ... // | |
/// <summary> | |
/// Load up the right round inspector and , activate the appropriate bins and dispensers. | |
/// </summary> | |
protected async void StartRound(RoundStartEvent StartEvent) | |
{ | |
if (!_GameManager.GameState()) { | |
Debug.LogWarning("Attempting to start a round for a game that is not started"); | |
return; | |
} | |
_GameManager.CurrentGame.AdvanceRound(); | |
_EventBus.Publish(new RoundCountdownStartEvent()); | |
Debug.Log("before Await"); | |
await Task.Delay(_Settings.roundStartDelay); | |
Debug.Log("after await"); | |
// Check to make sure the game hasn't changed in the rest time | |
if (!_GameManager.GameState()) { | |
Debug.Log("Game ended after the round start timer was started"); | |
return; | |
} | |
_EventBus.Publish(new RoundCountdownEndEvent()); | |
ResetBins(CurrentRound); | |
ActivateDispensers(CurrentRound); | |
SetRoundInspector(CurrentRound); | |
SetScoringStrategy(CurrentRound); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment