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

updates moveable tiles after moving, added boolean in game state to check if a unit has moved yet

parent 5f6232a9
No related branches found
No related tags found
No related merge requests found
......@@ -203,13 +203,18 @@ namespace Controller
if (GameState.isPlayableUnitSelected())
{
Unit unit = GameState.getSelectedUnit();
if (!GameState.getIsAnimating())
{
if (GameState.getBeforeMove())
{
#region Highlight nodes
//Highlight movable nodes in blue
LinkedList<Node> moveableNodes = GameFunction.getMovableNodes(graph, unit);
foreach(Node move in moveableNodes)
foreach (Node move in moveableNodes)
{
spriteBatch.Draw(moveableNode, move.getPosition(), null, Color.White*0.2f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.9f);
spriteBatch.Draw(moveableNode, move.getPosition(), null, Color.White * 0.2f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.9f);
}
//Highlight attackable nodes in red
......@@ -218,13 +223,17 @@ namespace Controller
{
if (!moveableNodes.Contains(attack))
{
spriteBatch.Draw(attackableNode, attack.getPosition(), null, Color.White*0.2f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.9f);
spriteBatch.Draw(attackableNode, attack.getPosition(), null, Color.White * 0.2f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.9f);
}
}
#endregion
#endregion
}else
{
}
#region Drop Down menu
if ((GameState.getMenuOpen())&&(!GameState.getIsAnimating())) // if dropDowMenu should be opened, draw dropDownMenu
if (GameState.getMenuOpen()) // if dropDowMenu should be opened, draw dropDownMenu
{
foreach (MenuButton button in unit.getMenuButtons())
{
......@@ -232,6 +241,7 @@ namespace Controller
}
}
#endregion
}
#region Character Info Screen
Vector2 statLocation = new Vector2(180, 533); //starting location for first stat
......
......@@ -15,7 +15,8 @@ namespace Model
private static Unit selectedUnit; // the currently selected unit
private static Player currentPlayer; // player of the current turn
private static bool isAnimating = false; // indicates whether an animation sequence is on screen
private static bool dropDownMenuOpen;
private static bool dropDownMenuOpen; // indicates whether drop down menu should be open
private static bool beforeMove; // true before unit moves, false after it moves. Used to determine what tiles are highlighted
// indicates if a unit is currently selected
public static bool isPlayableUnitSelected()
......@@ -70,6 +71,16 @@ namespace Model
{
return dropDownMenuOpen;
}
public static void setBeforeMove(bool hasMove)
{
beforeMove = hasMove;
}
public static bool getBeforeMove()
{
return beforeMove;
}
}
enum GameMenuState // enumerated list for different possible Game States
......
......@@ -92,6 +92,7 @@ namespace Controller
{
setSelectedUnit(unit, true);
GameState.setMenuOpen(true);
GameState.setBeforeMove(true);
}
}
......@@ -143,6 +144,7 @@ namespace Controller
}
GameState.setIsAnimating(false);
GameState.setBeforeMove(false);
}
// returns a menu button that was clicked; if no menu button was clicked, returns null
......
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