Skip to content
Snippets Groups Projects
Commit bee1c501 authored by Susan Yuen's avatar Susan Yuen
Browse files

Got rid of unit.isClickedOn()

parent a38a416e
No related branches found
No related tags found
No related merge requests found
......@@ -183,14 +183,18 @@ namespace Controller
// draws units for player 1
for (int i = 0; i < player1.getNumOfUnits(); i++)
{
Unit unit = player1.getUnits().ElementAt(i); //gets unit at i
spriteBatch.Draw(unit.getSpriteImage(), unit.getPixelCoordinates(), null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.8f); //redraws char sprite
spriteBatch.Draw(unit.getSpriteImage(), unit.getPixelCoordinates(), null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.8f); // redraws char sprite
#region When Unit is selected
}
#endregion
#region When Unit is selected
//if unit is currently clicked on
if (unit.getClickedOn())
if (GameState.isPlayableUnitSelected())
{
Unit unit = GameState.getSelectedUnit();
#region Highlight nodes
//Highlight movable nodes in blue
LinkedList<Node> moveableNodes = GameFunction.getMovableNodes(graph, unit);
......@@ -229,9 +233,7 @@ namespace Controller
Vector2 statLocation = new Vector2(180, 533); //starting location for first stat
Vector2 increment = new Vector2(0, 11.5f); //increment downwards for each stat
Vector2 infoLocation = new Vector2(20, 513);
for (int k=0; k<7; k++) //for 6 stats - str, int, skill, speed, def, res
{
spriteBatch.DrawString(font, unit.getStats(k).ToString(), statLocation, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws each stat
......@@ -240,19 +242,12 @@ namespace Controller
spriteBatch.DrawString(largeFont, unit.getHp().ToString(), new Vector2(255, 515), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws each stat
spriteBatch.Draw(unit.getCharInfo(), infoLocation, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charInfoBackground texture
#endregion
}
#endregion
}
#endregion
#region Player 2 Units
// draws units for player 2
for (int i = 0; i < player2.getNumOfUnits(); i++)
......
......@@ -44,6 +44,12 @@ namespace Controller
// if player clicks after unit is already selected ...
if (GameState.isPlayableUnitSelected())
{
// TODO: determine if player has clicked on a menu button
//if (mouseClickCoordinates == GameState.getSelectedUnit())
//{
//}
// if user clicks on a valid end node, move to it
Node startNode = graph.getNode(GameState.getSelectedUnit().getPosition());
Node endNode = graph.getNode(mouseClickCoordinates);
......
......@@ -36,8 +36,6 @@ namespace Model
void setPosition(int x, int y); // sets the current position (by node) of the unit
void setEquippedWeapon(Weapon w); // sets the unit's currently equipped weapon
void setMoved(bool a); // on start of players turn, set all units to unmoved (F)
void setClickedOn(bool a); // sets unit if it has been clicked on or not
bool getClickedOn(); // returns if the unit has been clicked on
void setMenuOpen(bool a); // Sets if the dropdown menu should be opened
bool getMenuOpen(); // returns if the dropdown menu should be open
}
......
......@@ -201,21 +201,13 @@ namespace Model
{
this.moved = a;
}
//set if unit has been clicked on
public void setClickedOn(bool a)
{
clickedOn = a;
}
// return if unit has been clicked on
public Boolean getClickedOn()
{
return clickedOn;
}
// set if menu should be open
public void setMenuOpen(bool a)
{
menuOpen = a;
}
// return if menu has been open
public Boolean getMenuOpen()
{
......
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