Skip to content
Snippets Groups Projects
Commit 5721b4e9 authored by Trandinh Thien's avatar Trandinh Thien
Browse files

Fixed crash after player owns no units

parent 2f11080f
No related branches found
No related tags found
No related merge requests found
......@@ -224,12 +224,7 @@ namespace Controller
Debug.WriteLine(player1.getNumOfUnits());
if (GameFunction.isGameOver(player1, player2))
{
// TODO: game over screen
Debug.WriteLine("Game is over.");
break;
}
if (GameFunction.isTurnOver())
{
......@@ -243,12 +238,24 @@ namespace Controller
foreach(Unit unit in player1.getUnits())
{
GameFunction.removeDeceasedUnit(graph, player1, unit);
if (GameFunction.isGameOver(player1, player2))
{
// TODO: game over screen
Debug.WriteLine("Game is over.");
break;
}
}
// removes deceased units in Player 2
foreach (Unit unit in player2.getUnits())
{
GameFunction.removeDeceasedUnit(graph, player2, unit);
if (GameFunction.isGameOver(player1, player2))
{
// TODO: game over screen
Debug.WriteLine("Game is over.");
break;
}
}
break;
}
......
......@@ -65,7 +65,8 @@ namespace Model
Playing, // Playing game Screen
DropDownMenu, // Drop down menu for action
CharMenu, // character drop down info menu
AttackMenu // attack menu
AttackMenu, // attack menu
GameOver // Game is Over
}
/*
enumerated list for what the current turn state is (per unit)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment