diff --git a/src/Blaze-Brigade/Blaze_Brigade/Archer.cs b/src/Blaze-Brigade/Blaze_Brigade/Archer.cs index 850c7cb7371739fe6e3fb3810e99176dbf8422da..af9a27addfa62f154a3580605ecb43c3af8ce04b 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Archer.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Archer.cs @@ -42,7 +42,7 @@ namespace Model Sets and returns a unit's Level. Currently does not have any use */ public int Level { get; set; } - + /** returns weapon the unit is currently equipping */ @@ -50,11 +50,7 @@ namespace Model /** the current frame the sprite is on */ - public int currentFrame { get; set; } - /** - Indicates whether or not the unit has moved. - */ - public bool hasMoved { get; set; } + public int currentFrame { get; set; } private readonly int movability = 5; // Archer movement is permanently set to 5 private Weapon[] equipableWeapons; // Array of all equipable weapons @@ -65,7 +61,7 @@ namespace Model private Texture2D spriteImage; // the char sprite private Vector2 pixelCoordinates; // the pixel coordinate of the unit private Tuple<int, int> position; // the tile location of the unit - private Button[] buttons = new Button[8]; // the buttons associated with the unit + private Button[] buttons = new Button[9]; // the buttons associated with the unit private Texture2D charInfo, charAttackInfo, healthBar; // The character and attack info, and health bar textures private readonly int maxHp = 9; // The max HP of character @@ -95,6 +91,7 @@ namespace Model buttons[5] = unitButtons[5]; buttons[6] = unitButtons[6]; buttons[7] = unitButtons[7]; + buttons[8] = unitButtons[8]; this.charInfo = charInfo; this.charAttackInfo = charAttackInfo; this.healthBar = healthBar; @@ -257,20 +254,22 @@ namespace Model { case ButtonType.Attack: // if attack clicked return buttons[0].getImage(); - case ButtonType.Items: // if item is clicked + case ButtonType.Move: // if moved is clicked return buttons[1].getImage(); - case ButtonType.Wait: // if wait is clicked + case ButtonType.Items: // if item is clicked return buttons[2].getImage(); - case ButtonType.AttackConfirm: // if attack confirm is clicked + case ButtonType.Wait: // if wait is clicked return buttons[3].getImage(); - case ButtonType.Inventory1: // if item1 clicked + case ButtonType.AttackConfirm: // if attack confirm is clicked return buttons[4].getImage(); - case ButtonType.Inventory2: // if item2 is clicked + case ButtonType.Inventory1: // if item1 clicked return buttons[5].getImage(); - case ButtonType.Inventory3: // if item3 is clicked + case ButtonType.Inventory2: // if item2 is clicked return buttons[6].getImage(); - case ButtonType.Inventory4: // if item4 is clicked + case ButtonType.Inventory3: // if item3 is clicked return buttons[7].getImage(); + case ButtonType.Inventory4: // if item4 is clicked + return buttons[8].getImage(); default: return null; } @@ -287,20 +286,22 @@ namespace Model { case ButtonType.Attack: return buttons[0].Active; - case ButtonType.Items: + case ButtonType.Move: return buttons[1].Active; - case ButtonType.Wait: + case ButtonType.Items: return buttons[2].Active; - case ButtonType.AttackConfirm: + case ButtonType.Wait: return buttons[3].Active; - case ButtonType.Inventory1: + case ButtonType.AttackConfirm: return buttons[4].Active; - case ButtonType.Inventory2: + case ButtonType.Inventory1: return buttons[5].Active; - case ButtonType.Inventory3: + case ButtonType.Inventory2: return buttons[6].Active; - case ButtonType.Inventory4: + case ButtonType.Inventory3: return buttons[7].Active; + case ButtonType.Inventory4: + return buttons[8].Active; default: return false; } @@ -380,20 +381,22 @@ namespace Model { case ButtonType.Attack: return buttons[0]; - case ButtonType.Items: + case ButtonType.Move: return buttons[1]; - case ButtonType.Wait: + case ButtonType.Items: return buttons[2]; - case ButtonType.AttackConfirm: + case ButtonType.Wait: return buttons[3]; - case ButtonType.Inventory1: + case ButtonType.AttackConfirm: return buttons[4]; - case ButtonType.Inventory2: + case ButtonType.Inventory1: return buttons[5]; - case ButtonType.Inventory3: + case ButtonType.Inventory2: return buttons[6]; - case ButtonType.Inventory4: + case ButtonType.Inventory3: return buttons[7]; + case ButtonType.Inventory4: + return buttons[8]; default: return null; } @@ -410,7 +413,7 @@ namespace Model public void setButtonCoordinates(Vector2 pixelCoordinates) { int offsetInactive = 0; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 4; i++) { if (!buttons[i].Active) { @@ -419,7 +422,7 @@ namespace Model buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y + (i * 32) + offsetInactive)); } buttons[4].setPixelCoordinates(330, 120); - for (int i = 4; i < 8; i++) + for (int i = 5; i < 9; i++) { buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 160), (int)(pixelCoordinates.Y + (i * 32 - 96))); } diff --git a/src/Blaze-Brigade/Blaze_Brigade/Button.cs b/src/Blaze-Brigade/Blaze_Brigade/Button.cs index 8fafd77431b39ae089e3d3d8e251e2c944907ca8..295609f8d7856891f0fad5ba8599684e8d9e4878 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Button.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Button.cs @@ -95,6 +95,7 @@ namespace View { Attack, AttackConfirm, + Move, Items, Wait, Inventory1, diff --git a/src/Blaze-Brigade/Blaze_Brigade/DrawClass.cs b/src/Blaze-Brigade/Blaze_Brigade/DrawClass.cs index c6d38941067285f6470b0afbfc2bc78efe057974..385bf69adfd02bdb956ef4d364215efd58b1bcfc 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/DrawClass.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/DrawClass.cs @@ -101,7 +101,7 @@ namespace View } /** - Draws all active buttons for the currently selected unit. The 4 possible active button is Attack, Item and Wait. + Draws all active buttons for the currently selected unit. The 4 possible active button is Attack, Move, Item and Wait. \param spriteBatch to draw 2D bitmap to screen */ public static void drawDropDownMenu(SpriteBatch spriteBatch) @@ -109,7 +109,7 @@ namespace View Unit unit = GameState.selectedUnit; unit.setButtonCoordinates(unit.PixelCoordinates); Button[] unitButtons = unit.getButtons(); - for (int i = 0; i < 3; i++) + for (int i = 0; i < 4; i++) { if (unitButtons[i].Active) { @@ -129,7 +129,7 @@ namespace View Unit unit = GameState.selectedUnit; unit.setButtonCoordinates(unit.PixelCoordinates); // update button positions Button[] unitButtons = unit.getButtons(); // for each inventory button - for (int i = 4; i < 8; i++) + for (int i = 5; i < 9; i++) { if (unitButtons[i].Active) // if inventory menu buttons are active { diff --git a/src/Blaze-Brigade/Blaze_Brigade/Game.cs b/src/Blaze-Brigade/Blaze_Brigade/Game.cs index 70f1d27b745a513ef6e354f02a244526efa82922..71062cc1b0c6b0b796f7344fbfc700524ad4f74b 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Game.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Game.cs @@ -424,15 +424,16 @@ namespace Controller // method to return a unit: takes in unit type (warrior/mage/ranger), unit position, and which player's unit (since different model/colors) private Unit getNewUnit(UnitType unitType, Vector2 unitPosition, Player player) { - Button[] unitButtons = new Button[8]; + Button[] unitButtons = new Button[9]; unitButtons[0] = new Button(ButtonType.Attack, unitPosition, Content.Load<Texture2D>("attack")); - unitButtons[1] = new Button(ButtonType.Items, unitPosition, Content.Load<Texture2D>("items")); ; - unitButtons[2] = new Button(ButtonType.Wait, unitPosition, Content.Load<Texture2D>("wait")); ; - unitButtons[3] = new Button(ButtonType.AttackConfirm, new Vector2(328, 130), Content.Load<Texture2D>("confirm_attack")); - unitButtons[4] = new Button(ButtonType.Inventory1, unitPosition, Content.Load<Texture2D>("Inventory_Button")); - unitButtons[5] = new Button(ButtonType.Inventory2, unitPosition, Content.Load<Texture2D>("Inventory_Button")); - unitButtons[6] = new Button(ButtonType.Inventory3, unitPosition, Content.Load<Texture2D>("Inventory_Button")); - unitButtons[7] = new Button(ButtonType.Inventory4, unitPosition, Content.Load<Texture2D>("Inventory_Button")); + unitButtons[1] = new Button(ButtonType.Move, unitPosition, Content.Load<Texture2D>("move")); + unitButtons[2] = new Button(ButtonType.Items, unitPosition, Content.Load<Texture2D>("items")); ; + unitButtons[3] = new Button(ButtonType.Wait, unitPosition, Content.Load<Texture2D>("wait")); ; + unitButtons[4] = new Button(ButtonType.AttackConfirm, new Vector2(328, 130), Content.Load<Texture2D>("confirm_attack")); + unitButtons[5] = new Button(ButtonType.Inventory1, unitPosition, Content.Load<Texture2D>("Inventory_Button")); + unitButtons[6] = new Button(ButtonType.Inventory2, unitPosition, Content.Load<Texture2D>("Inventory_Button")); + unitButtons[7] = new Button(ButtonType.Inventory3, unitPosition, Content.Load<Texture2D>("Inventory_Button")); + unitButtons[8] = new Button(ButtonType.Inventory4, unitPosition, Content.Load<Texture2D>("Inventory_Button")); // creates human-like characters for current player if (player == GameState.currentPlayer) diff --git a/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs b/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs index e765bf986dc3005c64207828e865a0bd282903db..893b4ce6f781f521ca799d50349a24cf5106a052 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs @@ -6,6 +6,7 @@ using System.Threading; using Model; using View; using Microsoft.Xna.Framework; +using System.Diagnostics; namespace Controller { @@ -465,6 +466,7 @@ namespace Controller In addition, specific actions for each button include: - If Attack is clicked, updates GameState's dropDownMenuOpen and attackSelect. - If AttackConfirm is clicked, updates the unit's Active button states, unit stats (including damage to HP), as well as several GameState variables. + - If Move is clicked, updates GameState's dropDownMenuOpen. - If Items is clicked, updates GameState's inventoryOppen. - If Wait is clicked, deselects the unit and updates the Wait button's Active status. - If any of the items in the inventory are clicked, causes the unit to equip the item and update the GameState's inventoryOpen. \n\n @@ -495,7 +497,7 @@ namespace Controller // if confirm attack clicked case ButtonType.AttackConfirm: button.Active = false; - unit.hasMoved = true; // set that unit has moved + unit.getButtonType(ButtonType.Move).Active = false; // move button is no longer active unit.getButtonType(ButtonType.Attack).Active = false; // attack button is no longer active //Gets attack animation direction @@ -556,6 +558,17 @@ namespace Controller break; #endregion + #region Move Button + // if Move is clicked + case ButtonType.Move: + if (button.Active) // if unit hasn't already moved + { + GameState.TurnState = TurnState.Move; + GameState.dropDownMenuOpen = false; // close the dropdownmenu when selecting where to move + } + break; + #endregion + #region Item Button case ButtonType.Items: // if item is clicked GameState.TurnState = TurnState.Items; diff --git a/src/Blaze-Brigade/Blaze_Brigade/Mage.cs b/src/Blaze-Brigade/Blaze_Brigade/Mage.cs index a4b7eb316527b9c09ff79fad7b186bc72d2a39ed..496ff4b37b19e77354b4489c29618e3a9647d80f 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Mage.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Mage.cs @@ -51,10 +51,6 @@ namespace Model the current frame the sprite is on */ public int currentFrame { get; set; } - /** - Indicates whether or not the unit has moved. - */ - public bool hasMoved { get; set; } private readonly int movability = 4; // Archer movement is permanently set to 5 private Weapon[] equipableWeapons; // Array of all equipable weapons @@ -65,7 +61,7 @@ namespace Model private Texture2D spriteImage; // the char sprite private Vector2 pixelCoordinates; // the pixel coordinate of the unit private Tuple<int, int> position; // the tile location of the unit - private Button[] buttons = new Button[8]; // the buttons associated with the unit + private Button[] buttons = new Button[9]; // the buttons associated with the unit private Texture2D charInfo, charAttackInfo, healthBar; // The character and attack info textures private readonly int maxHp = 8; // The max HP of character @@ -94,6 +90,7 @@ namespace Model buttons[5] = unitButtons[5]; buttons[6] = unitButtons[6]; buttons[7] = unitButtons[7]; + buttons[8] = unitButtons[8]; this.charInfo = charInfo; this.charAttackInfo = charAttackInfo; this.healthBar = healthBar; @@ -256,20 +253,22 @@ namespace Model { case ButtonType.Attack: // if attack clicked return buttons[0].getImage(); - case ButtonType.Items: // if item is clicked + case ButtonType.Move: // if moved is clicked return buttons[1].getImage(); - case ButtonType.Wait: // if wait is clicked + case ButtonType.Items: // if item is clicked return buttons[2].getImage(); - case ButtonType.AttackConfirm: // if attack confirm is clicked + case ButtonType.Wait: // if wait is clicked return buttons[3].getImage(); - case ButtonType.Inventory1: // if item1 clicked + case ButtonType.AttackConfirm: // if attack confirm is clicked return buttons[4].getImage(); - case ButtonType.Inventory2: // if item2 is clicked + case ButtonType.Inventory1: // if item1 clicked return buttons[5].getImage(); - case ButtonType.Inventory3: // if item3 is clicked + case ButtonType.Inventory2: // if item2 is clicked return buttons[6].getImage(); - case ButtonType.Inventory4: // if item4 is clicked + case ButtonType.Inventory3: // if item3 is clicked return buttons[7].getImage(); + case ButtonType.Inventory4: // if item4 is clicked + return buttons[8].getImage(); default: return null; } @@ -286,20 +285,22 @@ namespace Model { case ButtonType.Attack: return buttons[0].Active; - case ButtonType.Items: + case ButtonType.Move: return buttons[1].Active; - case ButtonType.Wait: + case ButtonType.Items: return buttons[2].Active; - case ButtonType.AttackConfirm: + case ButtonType.Wait: return buttons[3].Active; - case ButtonType.Inventory1: + case ButtonType.AttackConfirm: return buttons[4].Active; - case ButtonType.Inventory2: + case ButtonType.Inventory1: return buttons[5].Active; - case ButtonType.Inventory3: + case ButtonType.Inventory2: return buttons[6].Active; - case ButtonType.Inventory4: + case ButtonType.Inventory3: return buttons[7].Active; + case ButtonType.Inventory4: + return buttons[8].Active; default: return false; } @@ -321,12 +322,12 @@ namespace Model return charAttackInfo; } - /** - gets and sets unit's position by tile. The set also updates pixelCoordinate's location by making - that vector equivalent to position*32 (since each tile is 32x32). - \b Exceptions: \n - -Dead units will still have a position, but won't impact the rest of the game - */ + /** + gets and sets unit's position by tile. The set also updates pixelCoordinate's location by making + that vector equivalent to position*32 (since each tile is 32x32). + \b Exceptions: \n + -Dead units will still have a position, but won't impact the rest of the game + */ public Tuple<int, int> Position { get @@ -379,20 +380,22 @@ namespace Model { case ButtonType.Attack: return buttons[0]; - case ButtonType.Items: + case ButtonType.Move: return buttons[1]; - case ButtonType.Wait: + case ButtonType.Items: return buttons[2]; - case ButtonType.AttackConfirm: + case ButtonType.Wait: return buttons[3]; - case ButtonType.Inventory1: + case ButtonType.AttackConfirm: return buttons[4]; - case ButtonType.Inventory2: + case ButtonType.Inventory1: return buttons[5]; - case ButtonType.Inventory3: + case ButtonType.Inventory2: return buttons[6]; - case ButtonType.Inventory4: + case ButtonType.Inventory3: return buttons[7]; + case ButtonType.Inventory4: + return buttons[8]; default: return null; } @@ -409,7 +412,7 @@ namespace Model public void setButtonCoordinates(Vector2 pixelCoordinates) { int offsetInactive = 0; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 4; i++) { if (!buttons[i].Active) { @@ -418,7 +421,7 @@ namespace Model buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y + (i * 32) + offsetInactive)); } buttons[4].setPixelCoordinates(330, 120); - for (int i = 4; i < 8; i++) + for (int i = 5; i < 9; i++) { buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 160), (int)(pixelCoordinates.Y + (i * 32 - 96))); } diff --git a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs index a412ce05335109fc12209a115fe603a08076b6cb..1dfd8a1f8f02e061a2e00e84bc0835d877e112b5 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs @@ -85,7 +85,7 @@ namespace Controller Vector2 mouseClickCoordinates = new Vector2(currentMouseState.X - camera.Position.X, currentMouseState.Y - camera.Position.Y); Node nodeClickedOn = graph.getNode(mouseClickCoordinates); - // if end turn is clicked, ends the current player's turn + //if end turn is clicked, ends the current player's turn if (GameState.endTurnButton) { if (mouseClickCoordinates.X > GameState.endTurnButtonLocation.X && @@ -130,10 +130,11 @@ namespace Controller return; } - // if selected unit has not yet moved & user clicks on a valid end node, move to it - #region Unit Movement - if (!GameState.selectedUnit.hasMoved) + // if user clicks on a valid end node, move to it + if (GameState.TurnState == TurnState.Move) { + Game.Instance.Tick(); + // set variables for path finding Node startNode = graph.getNode(GameState.selectedUnit.Position); Node endNode = graph.getNode(mouseClickCoordinates); @@ -142,18 +143,16 @@ namespace Controller // if path finder returns a non-null path, then end node is valid if (path != null) { - Game.Instance.Tick(); - GameState.selectedUnit.hasMoved = true; // set unit status to moved + GameState.selectedUnit.getButtonType(ButtonType.Move).Active = false; // move button no longer active GameFunction.updateUnitPosition(graph, path); GameState.beforeMove = false; GameState.TurnState = TurnState.Wait; } else { - return; // if user clicks on invalid end node, do nothing + GameFunction.deselectUnit(); // if user clicks on invalid end node, deselect it } } - #endregion if (GameState.TurnState == TurnState.Attack) // if a unit is clicked after attack is clicked { @@ -183,7 +182,7 @@ namespace Controller GameState.selectedUnit = unit; GameFunction.setMovableNodes(graph, unit); GameState.dropDownMenuOpen = true; - if (!unit.hasMoved) + if (unit.getButtonType(ButtonType.Move).Active) { GameState.beforeMove = true; } diff --git a/src/Blaze-Brigade/Blaze_Brigade/Unit.cs b/src/Blaze-Brigade/Blaze_Brigade/Unit.cs index 6b01efa0a808c189f7a5243cfb0e400e4d6efea7..c8bea4c9203c785bc512b3117449577b86cb2752 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Unit.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Unit.cs @@ -103,11 +103,6 @@ namespace Model */ Weapon equippedWeapon { get; set; } - /** - Indicates whether or not the unit has moved. - */ - bool hasMoved { get; set; } - // TODO void setEquipableWeapons(Weapon add); // need to update the weapon array, put new weapon into it /** diff --git a/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs b/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs index 83da59a82ab73960f77d91fc4add5a58ab810bdf..bf659d7aa91f961e44b5392d0b6f7691fefd80f0 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs @@ -51,10 +51,6 @@ namespace Model the current frame the sprite is on */ public int currentFrame { get; set; } - /** - Indicates whether or not the unit has moved. - */ - public bool hasMoved { get; set; } private readonly int movability = 5; // Warrior movement is permanently set to 5 private Weapon[] equipableWeapons; // Array of all equipable weapons @@ -65,7 +61,7 @@ namespace Model private Texture2D spriteImage; // the char sprite private Vector2 pixelCoordinates; // the pixel coordinate of the unit private Tuple<int, int> position; // the tile location of the unit - private Button[] buttons = new Button[8]; // the buttons associated with the unit + private Button[] buttons = new Button[9]; // the buttons associated with the unit private Texture2D charInfo, charAttackInfo, healthBar; // The character and attack info, and health bar textures private readonly int maxHp = 10; // The max HP of character @@ -94,6 +90,7 @@ namespace Model buttons[5] = unitButtons[5]; buttons[6] = unitButtons[6]; buttons[7] = unitButtons[7]; + buttons[8] = unitButtons[8]; this.charInfo = charInfo; this.charAttackInfo = charAttackInfo; this.healthBar = healthBar; @@ -256,20 +253,22 @@ namespace Model { case ButtonType.Attack: // if attack clicked return buttons[0].getImage(); - case ButtonType.Items: // if item is clicked + case ButtonType.Move: // if moved is clicked return buttons[1].getImage(); - case ButtonType.Wait: // if wait is clicked + case ButtonType.Items: // if item is clicked return buttons[2].getImage(); - case ButtonType.AttackConfirm: // if attack confirm is clicked + case ButtonType.Wait: // if wait is clicked return buttons[3].getImage(); - case ButtonType.Inventory1: // if item1 clicked + case ButtonType.AttackConfirm: // if attack confirm is clicked return buttons[4].getImage(); - case ButtonType.Inventory2: // if item2 is clicked + case ButtonType.Inventory1: // if item1 clicked return buttons[5].getImage(); - case ButtonType.Inventory3: // if item3 is clicked + case ButtonType.Inventory2: // if item2 is clicked return buttons[6].getImage(); - case ButtonType.Inventory4: // if item4 is clicked + case ButtonType.Inventory3: // if item3 is clicked return buttons[7].getImage(); + case ButtonType.Inventory4: // if item4 is clicked + return buttons[8].getImage(); default: return null; } @@ -286,20 +285,22 @@ namespace Model { case ButtonType.Attack: return buttons[0].Active; - case ButtonType.Items: + case ButtonType.Move: return buttons[1].Active; - case ButtonType.Wait: + case ButtonType.Items: return buttons[2].Active; - case ButtonType.AttackConfirm: + case ButtonType.Wait: return buttons[3].Active; - case ButtonType.Inventory1: + case ButtonType.AttackConfirm: return buttons[4].Active; - case ButtonType.Inventory2: + case ButtonType.Inventory1: return buttons[5].Active; - case ButtonType.Inventory3: + case ButtonType.Inventory2: return buttons[6].Active; - case ButtonType.Inventory4: + case ButtonType.Inventory3: return buttons[7].Active; + case ButtonType.Inventory4: + return buttons[8].Active; default: return false; } @@ -321,12 +322,12 @@ namespace Model return charAttackInfo; } - /** - gets and sets unit's position by tile. The set also updates pixelCoordinate's location by making - that vector equivalent to position*32 (since each tile is 32x32). - \b Exceptions: \n - -Dead units will still have a position, but won't impact the rest of the game - */ + /** + gets and sets unit's position by tile. The set also updates pixelCoordinate's location by making + that vector equivalent to position*32 (since each tile is 32x32). + \b Exceptions: \n + -Dead units will still have a position, but won't impact the rest of the game + */ public Tuple<int, int> Position { get @@ -379,20 +380,22 @@ namespace Model { case ButtonType.Attack: return buttons[0]; - case ButtonType.Items: + case ButtonType.Move: return buttons[1]; - case ButtonType.Wait: + case ButtonType.Items: return buttons[2]; - case ButtonType.AttackConfirm: + case ButtonType.Wait: return buttons[3]; - case ButtonType.Inventory1: + case ButtonType.AttackConfirm: return buttons[4]; - case ButtonType.Inventory2: + case ButtonType.Inventory1: return buttons[5]; - case ButtonType.Inventory3: + case ButtonType.Inventory2: return buttons[6]; - case ButtonType.Inventory4: + case ButtonType.Inventory3: return buttons[7]; + case ButtonType.Inventory4: + return buttons[8]; default: return null; } @@ -409,7 +412,7 @@ namespace Model public void setButtonCoordinates(Vector2 pixelCoordinates) { int offsetInactive = 0; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 4; i++) { if (!buttons[i].Active) { @@ -418,7 +421,7 @@ namespace Model buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y + (i * 32) + offsetInactive)); } buttons[4].setPixelCoordinates(330, 120); - for (int i = 4; i < 8; i++) + for (int i = 5; i < 9; i++) { buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 160), (int)(pixelCoordinates.Y + (i * 32 - 96))); }