Skip to content

Commit

Permalink
[GUI] Added animation timeout for computer turn
Browse files Browse the repository at this point in the history
  • Loading branch information
dodikk committed Dec 19, 2015
1 parent de14b38 commit 7acfb24
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Reversi/Assets/BoardEventsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ private void handleTapOnCell(GameObject cellCube)

if (IS_OPPONENT_PLAYER_AI)
{
while (this.IsTurnOfAI)
{
this.makeTurnByAI();
}
StartCoroutine("coroutineMakeTurnByAI");
}
}

Expand All @@ -154,6 +151,15 @@ private void makeTurn(IReversiTurn turn)
}
#endregion

private IEnumerator coroutineMakeTurnByAI()
{
while (this.IsTurnOfAI)
{
yield return new WaitForSeconds(TURN_ANIMATION_DELAY);
this.makeTurnByAI();
}
}

private void makeTurnByAI()
{
IReversiTurn selectedTurn =
Expand Down Expand Up @@ -468,6 +474,7 @@ private void populateLabels()
private const int BOARD_SIZE = 8;
private const string CELL_TAG = "FieldCell";
private const string BALL_TAG = "Ball";
private const float TURN_ANIMATION_DELAY = 0.5f;

private IEnumerable<IReversiTurn> _validTurns ;
bool _isGameOver;
Expand Down

0 comments on commit 7acfb24

Please sign in to comment.