From cefc75f764799b9d408123124675fe48d610fb17 Mon Sep 17 00:00:00 2001
From: Susan Yuen <susan_loves_cheese@hotmail.com>
Date: Tue, 1 Nov 2016 03:20:48 -0400
Subject: [PATCH] Changed MouseHandler, GameFunction, GameState to static
 classes. Fixed buggy unit movement (by recoding updateUnitPosition in
 MouseHandler). Removed unnecessary variables from Node. Created GameState
 class.

---
 src/Blaze-Brigade/Blaze_Brigade/Game.cs       |  78 ++++++------
 .../Blaze_Brigade/GameFunction.cs             | 101 ++++-----------
 src/Blaze-Brigade/Blaze_Brigade/GameState.cs  |  73 +++++++++++
 .../Blaze_Brigade/MouseHandler.cs             | 116 +++++++-----------
 src/Blaze-Brigade/Blaze_Brigade/Node.cs       |  28 -----
 src/Blaze-Brigade/Blaze_Brigade/Warrior.cs    |   3 +-
 6 files changed, 178 insertions(+), 221 deletions(-)
 create mode 100644 src/Blaze-Brigade/Blaze_Brigade/GameState.cs

diff --git a/src/Blaze-Brigade/Blaze_Brigade/Game.cs b/src/Blaze-Brigade/Blaze_Brigade/Game.cs
index 7d1c826..d494bca 100644
--- a/src/Blaze-Brigade/Blaze_Brigade/Game.cs
+++ b/src/Blaze-Brigade/Blaze_Brigade/Game.cs
@@ -25,40 +25,37 @@ namespace Controller
     {
 
         #region Variables
-        enum GameState //enumerated list for different possible Game States 
-        {
-            MainMenu, //menu screen
-            HowToPlay, //Instruction Screen
-            Playing, //Playing game Screen
-            DropDownMenu, //Drop down menu for action
-            CharMenu, //character drop down info menu
-            AttackMenu, //attack menu
 
-        }
-        GameState CurrentGameState = GameState.MainMenu; //game starts in main menu screen
-        readonly GameFunction gameFunction = new GameFunction(); 
-        readonly MouseHandler mouseHandler = new MouseHandler();
-        MainMenu mMenu; //main menu variable
-        HowToPlay tut; //instruction screen variable
+        GameMenuState currentGameState = GameMenuState.MainMenu; // game starts in main menu screen
+        MainMenu mMenu; // main menu variable
+        HowToPlay tut; // instruction screen variable
         Graph graph;
         Player player1;
         Player player2;
         dropDownMenu popUp;
+
+        // *************************************************************
+        // ** WE DO NOT NEED THIS!!!
+        // ** There is a function inside GameState.cs that sets the current player. Please use it! - Susan
+
         Player[] allPlayers; // If at [0] , p1 turn, etc. Iterates through array in incremental fashion. 
-                             // If at end, go back to index 0
+                             // If at end, go back to index 0.
+        // *************************************************************
+
         GraphicsDeviceManager graphics;
         SpriteBatch spriteBatch;
         Texture2D backGround, moveableNode, attackableNode;
-        private SpriteFont font; //custom font
-        private SpriteFont largeFont; //custom font 2
+        private SpriteFont font; // custom font
+        private SpriteFont largeFont; // custom font 2
+
         #endregion
 
         // constructor for game
         public Game()
         {
             graphics = new GraphicsDeviceManager(this);
-            graphics.PreferredBackBufferWidth = gameFunction.SCREEN_HEIGHT;
-            graphics.PreferredBackBufferHeight = gameFunction.SCREEN_WIDTH;
+            graphics.PreferredBackBufferWidth = GameState.SCREEN_HEIGHT;
+            graphics.PreferredBackBufferHeight = GameState.SCREEN_WIDTH;
             Content.RootDirectory = "Content";
 
             //instantiate the game windows
@@ -89,8 +86,8 @@ namespace Controller
             font = Content.Load<SpriteFont>("PixelFont"); //loads font PixelFont
             largeFont = Content.Load<SpriteFont>("PixelFontLarge"); //loads font PixelFont
 
-            graphics.PreferredBackBufferWidth = gameFunction.SCREEN_WIDTH; // width of screen
-            graphics.PreferredBackBufferHeight = gameFunction.SCREEN_HEIGHT; //height of screen
+            graphics.PreferredBackBufferWidth = GameState.SCREEN_WIDTH; // width of screen
+            graphics.PreferredBackBufferHeight = GameState.SCREEN_HEIGHT; //height of screen
 
             IsMouseVisible = true; // sets mouse visibility to true
             graphics.ApplyChanges(); // load images
@@ -102,7 +99,11 @@ namespace Controller
             graph = new Graph(50,32);
             player1 = new Player();
             player2 = new Player();
-            
+
+            // *************************************************************
+            // ** WE DO NOT NEED THIS!!!
+            // ** Please use GameState class for current player things - Susan
+
             allPlayers = new Player[2];
             // current turn based on index of array, perhaps a randomizing func to determine who goes first.
             // when turn over, move to next index of array. When at end of array, go to start
@@ -111,6 +112,7 @@ namespace Controller
             int turn = 0;
             // this while loop should allow for all game functions during turn?
             //while (allPlayers.ElementAt(turn).isTurnOver() == false) { }
+            // *************************************************************
 
             // load character sprite and set position
             Vector2 unit1Position = new Vector2(32.0f, 32.0f);
@@ -118,7 +120,7 @@ namespace Controller
             player1.addUnit(new Warrior(Content.Load<Texture2D>("charSprite"), Content.Load<Texture2D>("attack"), Content.Load<Texture2D>("move"), 
                 Content.Load<Texture2D>("items"), Content.Load<Texture2D>("wait"), Content.Load<Texture2D>("warrior_Info"), unit1Position));
 
-            gameFunction.setPlayerCurrentlyMoving(player1); // set game state
+            GameState.setPlayerCurrentlyMoving(player1); // set game state
         }
 
         // Updates game in real time - 60fps
@@ -132,16 +134,16 @@ namespace Controller
             if (this.IsActive)
             {
                 // call mouse handler if game window is active
-                mouseHandler.updateMouse(gameFunction, graph);
+                MouseHandler.updateMouse(graph);
             }
             #endregion
 
             #region Game States
             MouseState mouse = Mouse.GetState();
             //Lists possible game states
-            switch (CurrentGameState)
+            switch (currentGameState)
             {
-                case GameState.MainMenu: // if mouse is clicked... call method
+                case GameMenuState.MainMenu: // if mouse is clicked... call method
                     mMenu.Show(); // show main menu
                     if (mMenu.start == true) //if New game is selected
                     {
@@ -149,13 +151,13 @@ namespace Controller
                         tut.Close(); //close How To Play Menu
                         Form GameForm = (Form)Form.FromHandle(Window.Handle); 
                         GameForm.Opacity = 100; // make screen show
-                        CurrentGameState = GameState.Playing; //set game state to Playing
+                        currentGameState = GameMenuState.Playing; //set game state to Playing
                         break;
                     }
                     if (mMenu.getInstruct() == true) //if How to Play is selected
                     {
                         mMenu.Hide(); //hide visibility of menu window
-                        CurrentGameState = GameState.HowToPlay; //change game state to How To Play
+                        currentGameState = GameMenuState.HowToPlay; //change game state to How To Play
                         break;
                     }
                     if (mMenu.quit == true) // if quit clicked
@@ -165,19 +167,19 @@ namespace Controller
                     }
                     break;
 
-                case GameState.HowToPlay: // if true.. load new image...
+                case GameMenuState.HowToPlay: // if true.. load new image...
                     tut.Show(); //set visibility of how to play window to true
                     mMenu.setInstructFalse();
                     if (tut.getQuit() == true) // if quit clicked
                     {
                         tut.setQuitFalse();
                         tut.Hide(); //hide 
-                        CurrentGameState = GameState.MainMenu; //changes state back to main menu
+                        currentGameState = GameMenuState.MainMenu; //changes state back to main menu
                         break;
                     }
                     break;
 
-                case GameState.Playing: // if true.. load new image...
+                case GameMenuState.Playing: // if true.. load new image...
                     backGround = Content.Load<Texture2D>("Game_Map"); // load background
                     break;
             }
@@ -192,9 +194,9 @@ namespace Controller
             spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null);   // begin spriteBatch
             
             //only draw objects relevent to current game state
-            switch (CurrentGameState)
+            switch (currentGameState)
             {
-                case GameState.Playing: // while in game
+                case GameMenuState.Playing: // while in game
 
                     #region Player 1 Units
                     // draws units for player 1
@@ -210,14 +212,14 @@ namespace Controller
                         {
                             #region Highlight nodes
                             //Highlight movable nodes in blue
-                            LinkedList<Node> moveableNodes = gameFunction.getMovableNodes(graph, unit);
+                            LinkedList<Node> moveableNodes = GameFunction.getMovableNodes(graph, unit);
                             foreach(Node move in moveableNodes)
                             {
                                 spriteBatch.Draw(moveableNode, move.getPosition(), Color.White * 0.3f);
                             }
 
                             //Highlight attackable nodes in red
-                            LinkedList<Node> attackableNodes = gameFunction.getAttackableNodes(graph, unit);
+                            LinkedList<Node> attackableNodes = GameFunction.getAttackableNodes(graph, unit);
                             foreach (Node attack in attackableNodes)
                             {
                                 if (!moveableNodes.Contains(attack))
@@ -283,19 +285,15 @@ namespace Controller
                     }
                     #endregion
 
-
                     spriteBatch.Draw(backGround, Vector2.Zero, Color.White);    // draws background
                     
                     break;
 
                     
             }
-
-            
             spriteBatch.End();  // end spriteBatch
             base.Draw(gameTime);    // repeatedly calls draw
         }
-
-
+        
     }
 }
diff --git a/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs b/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs
index 8d406bd..2afc970 100644
--- a/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs
+++ b/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs
@@ -7,101 +7,51 @@ using Model;
 
 namespace Controller
 {
-    class GameFunction
+    // This class holds useable functions in the scope of the entire gameplay
+    static class GameFunction
     {
-        public readonly int SCREEN_HEIGHT = 640;
-        public readonly int SCREEN_WIDTH = 960;
-
-        private bool playableUnitSelected;
-        private Unit selectedUnit;
-        private Player currentPlayer;
-        private bool isAnimating = false;       // indicates whether an animation sequence is on screen
-
         // might not need; check if enemyUnitsInRange returns an empty list
-        public bool isAnEnemyUnitInRange(Unit unit)
+        public static bool isAnEnemyUnitInRange(Unit unit)
         {
             // TODO
             return false;
         }
-        // initilly, each unit should not have moved yet.
-        public void startTurn(Player player)
+
+        // sets all units to "not moved" upon start of a turn
+        public static void startTurn(Player player)
         {
             for (int i = 0; i < player.getUnits().Count; i++)
             {
-                player.getUnits().ElementAt(i).setMoved(false); // make sure each unit has not gone.
+                player.getUnits().ElementAt(i).setMoved(false);
             }
-            
         }
 
         // returns all enemy units in range of the specified unit
-        public LinkedList<Unit> enemyUnitsInRange(Unit unit)
+        public static LinkedList<Unit> enemyUnitsInRange(Unit unit)
         {
-            int range = unit.getEquippedWeapon().getRange(); // use this to determine all hitable squares.
+            // TODO
+            int range = unit.getEquippedWeapon().getRange();    // use this to determine all hitable squares
             return null;
         }
-
         
-
-        // returns the player that is currently moving
-        public Player playerCurrentlyMoving()
-        {
-            return currentPlayer;
-        }
-
-        public void setPlayerCurrentlyMoving(Player p)
-        {
-            currentPlayer = p;
-        }
-
-        // indicates if a unit is currently selected
-        public bool isPlayableUnitSelected()
-        {
-            return playableUnitSelected;
-        }
-
-        public void setPlayableUnitSelected(bool p)
-        {
-            playableUnitSelected = p;
-        }
-
         // checks if specified unit can perform actions
-        public bool hasUnitFinishedActions(Unit unit)
+        public static bool hasUnitFinishedActions(Unit unit)
         {
             // TODO
             return false;
         }
 
         // checks lose/win conditions to determine if game is over
-        public bool isGameOver()
+        public static bool isGameOver()
         {
             // TODO
             return false;
         }
-
-        public Unit getSelectedUnit()
-        {
-            return selectedUnit;
-        }
-
-        public void setSelectedUnit(Unit unit)
-        {
-            selectedUnit = unit;
-        }
-
-        public bool getIsAnimating()
-        {
-            return isAnimating;
-        }
-
-        public void setIsAnimating(bool animating)
-        {
-            isAnimating = animating;
-        }
-
+        
         // checks if the node is attackable based on the unit's class and position
         // I THINK THIS WOULD WORK MUCH SIMPLER BASED ON EQUIPPED WEAPON NOT UNIT TYPE!!
         // IF logic < equippedweapon.range or IF logic < weapon with highest range.
-        private bool isNodeAttackable(UnitType unitType, int unitX, int unitY, Node attackNode)
+        private static bool isNodeAttackable(UnitType unitType, int unitX, int unitY, Node attackNode)
         {
             int attackX = attackNode.getPositionX();
             int attackY = attackNode.getPositionY();
@@ -121,7 +71,7 @@ namespace Controller
             else if (unitType == UnitType.Archer &&
                 Math.Abs(unitX - attackX) + Math.Abs(unitY - attackY) == 2)
             {
-
+                return true;
             }
             // return mage attackable nodes (one node and two nodes away)
             else if (unitType == UnitType.Mage &&
@@ -130,12 +80,12 @@ namespace Controller
             {
                 return true;
             }
+
             return false;
         }
 
-        // returns a list of nodes that the unit can move onto (ie. used for highlighting movable nodes when selecting unit)
-       
-        public LinkedList<Node> getMovableNodes(Graph graph, Unit unit)
+        // returns a list of nodes that the unit can move onto
+        public static LinkedList<Node> getMovableNodes(Graph graph, Unit unit)
         {
             LinkedList<Node> moveableNodes = new LinkedList<Node>();
             Node currentNode = graph.getNode(unit.getPosition());
@@ -155,7 +105,7 @@ namespace Controller
         }
 
         // returns a list of nodes that the unit can attack on (ie. used for highlighting attackable nodes)
-        public LinkedList<Node> getAttackableNodes(Graph graph, Unit unit)
+        public static LinkedList<Node> getAttackableNodes(Graph graph, Unit unit)
         {
             LinkedList<Node> attackableNodes = new LinkedList<Node>();
             LinkedList<Node> moveableNodes = getMovableNodes(graph, unit);
@@ -181,7 +131,7 @@ namespace Controller
         }
 
         // returns list of nodes representing the path from start node to end node; if no path is valid, return null
-        public LinkedList<Node> pathFinder(Graph graph, Unit unit, Node start, Node end)
+        public static LinkedList<Node> pathFinder(Graph graph, Unit unit, Node start, Node end)
         {
             // TODO: (OPTIONAL, IGNORE FOR NOW) incorporate movability of nodes in the calculation
 
@@ -247,8 +197,7 @@ namespace Controller
                 nodeAdded = false;
             }
 
-            // if the node the algorithm ends on isnt the same as the end node, there is no valid path
-
+            // if the node the algorithm ends on isn't the same as the end node, there is no valid path
             if (!(path.Last() == end))
             {
                 return null;
@@ -257,15 +206,11 @@ namespace Controller
             return path;
         }
 
-        public void firstTurn()
+        public static void firstTurn()
         {
-
+            // TODO: what is this? - Susan
         }
-        
 
     }
-
-
-
 }
 
diff --git a/src/Blaze-Brigade/Blaze_Brigade/GameState.cs b/src/Blaze-Brigade/Blaze_Brigade/GameState.cs
new file mode 100644
index 0000000..bd90463
--- /dev/null
+++ b/src/Blaze-Brigade/Blaze_Brigade/GameState.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Model
+{
+    // This class holds states in the scope of the entire gameplay
+    static class GameState
+    {
+        public static readonly int SCREEN_HEIGHT = 640;
+        public static readonly int SCREEN_WIDTH = 960;
+
+        private static bool playableUnitSelected;      // indicates whether a unit is currently selected
+        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
+
+        // indicates if a unit is currently selected
+        public static bool isPlayableUnitSelected()
+        {
+            return playableUnitSelected;
+        }
+
+        public static void setPlayableUnitSelected(bool p)
+        {
+            playableUnitSelected = p;
+        }
+
+        // returns the currently selected unit
+        public static Unit getSelectedUnit()
+        {
+            return selectedUnit;
+        }
+
+        public static void setSelectedUnit(Unit unit)
+        {
+            selectedUnit = unit;
+        }
+
+        // returns the player that is currently moving
+        public static Player playerCurrentlyMoving()
+        {
+            return currentPlayer;
+        }
+
+        public static void setPlayerCurrentlyMoving(Player p)
+        {
+            currentPlayer = p;
+        }
+
+        // return whether an animation is currently displaying on screen
+        public static bool getIsAnimating()
+        {
+            return isAnimating;
+        }
+
+        public static void setIsAnimating(bool animating)
+        {
+            isAnimating = animating;
+        }
+    }
+
+    enum GameMenuState // enumerated list for different possible Game States
+    {
+        MainMenu,       // menu screen
+        HowToPlay,      // Instruction Screen
+        Playing,        // Playing game Screen
+        DropDownMenu,   // Drop down menu for action
+        CharMenu,       // character drop down info menu
+        AttackMenu      // attack menu
+    }
+}
diff --git a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs
index 8512a47..49dd5b2 100644
--- a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs
+++ b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs
@@ -11,73 +11,82 @@ using System.Diagnostics;
 
 namespace Controller
 {
-    class MouseHandler
+    static class MouseHandler
     {
-        MouseState lastMouseState;
-        MouseState currentMouseState;
-        int turnState = 0; // 0 = no button selected, 1 = attack selected, 2 = move selected
+        private static MouseState lastMouseState;          // this state allows for detection of a single click (not click and hold)
+        private static MouseState currentMouseState;
+        private static int turnState = 0;                  // 0 = no button selected, 1 = attack selected, 2 = move selected
 
-        public void updateMouse(GameFunction gameFunction, Graph graph)
+        public static void updateMouse(Graph graph)
         {
             lastMouseState = currentMouseState;
             currentMouseState = Mouse.GetState();
 
-            bool validX = currentMouseState.X < gameFunction.SCREEN_WIDTH && currentMouseState.X > 0;
-            bool validY = currentMouseState.Y < gameFunction.SCREEN_HEIGHT && currentMouseState.Y > 0;
+            // valid coordinates for the mouse (ie. must be inside the game window)
+            bool validX = currentMouseState.X < GameState.SCREEN_WIDTH && currentMouseState.X > 0;
+            bool validY = currentMouseState.Y < GameState.SCREEN_HEIGHT && currentMouseState.Y > 0;
 
-            // checks for single mouse click inside the window
+            // checks for single mouse left click inside the game window
             if (lastMouseState.LeftButton == ButtonState.Released
                 && currentMouseState.LeftButton == ButtonState.Pressed
                 && validX && validY)
             {
-                // do not react to user input if animation is on screen
-                if (gameFunction.getIsAnimating())
+                // do not react to mouse input if animation is on screen
+                if (GameState.getIsAnimating())
                 {
                     return;
                 }
 
-                Vector2 position = new Vector2(currentMouseState.X, currentMouseState.Y);
+                Vector2 mouseClickCoordinates = new Vector2(currentMouseState.X, currentMouseState.Y);   // mouse click coordinates
 
                 // TODO: determine if player has clicked on a menu button
 
                 #region Check if a unit is clicked
+
                 // if player clicks after unit is already selected ...
-                if (gameFunction.isPlayableUnitSelected())
+                if (GameState.isPlayableUnitSelected())
                 {
-                    Node startNode = graph.getNode(gameFunction.getSelectedUnit().getPosition());
-                    Node endNode = graph.getNode(position);
+                    // if user clicks on a valid end node, move to it
+                    Node startNode = graph.getNode(GameState.getSelectedUnit().getPosition());
+                    Node endNode = graph.getNode(mouseClickCoordinates);
+                    LinkedList<Node> path = GameFunction.pathFinder(graph, GameState.getSelectedUnit(), startNode, endNode);
 
-                    if (gameFunction.pathFinder(graph, gameFunction.getSelectedUnit(), startNode, endNode) != null)
+                    // if path finder returns a non-null path, then end node is valid
+                    if (path != null)
                     {
-                        updateUnitPosition(position, gameFunction);
+                        updateUnitPosition(mouseClickCoordinates, path);
                     }
-                    setSelectedUnit(gameFunction, null, false);
-                } else{
+                    setSelectedUnit(null, false);     // unselect the unit
+                }
+                // if player clicks when a unit is not selected ...
+                else
+                {
                     // if there is a playable, player-owned unit on position clicked, set selected unit status
-                    Unit unit = getPlayableUnitOnNodeClicked(graph.getNode(position), position, gameFunction.playerCurrentlyMoving());
+                    Unit unit = getPlayableUnitOnNodeClicked(graph.getNode(mouseClickCoordinates), mouseClickCoordinates, GameState.playerCurrentlyMoving());
                     if (unit != null)
                     {
-                        setSelectedUnit(gameFunction, unit, true);
+                        setSelectedUnit(unit, true);
                     }
                 }
+
                 #endregion
             }
         }
 
         // sets selection of unit state inside GameFunction and the unit itself
-        private void setSelectedUnit(GameFunction gameFunction, Unit unit, bool selected)
+        private static void setSelectedUnit(Unit unit, bool selected)
         {
             if (unit != null)
             {
                 unit.setMenuOpen(selected);
                 unit.setClickedOn(selected);
             }
-            gameFunction.setPlayableUnitSelected(selected);
-            gameFunction.setSelectedUnit(unit);
+            GameState.setPlayableUnitSelected(selected);
+            GameState.setSelectedUnit(unit);
         }
 
         // if playable unit exists where user clicked, return it; else, return null
-        private Unit getPlayableUnitOnNodeClicked(Node clickedNode, Vector2 positionClicked, Player currentPlayer)
+        private static Unit getPlayableUnitOnNodeClicked(Node clickedNode, Vector2 positionClicked, Player currentPlayer)
         {
             for (int i = 0; i < currentPlayer.getNumOfUnits(); i++)
             {
@@ -95,61 +104,20 @@ namespace Controller
         }
 
         // update the unit's position to the clicked position
-        private void updateUnitPosition(Vector2 position, GameFunction gameFunction)
+        private static void updateUnitPosition(Vector2 position, LinkedList<Node> path)
         {
-            int positionX = (int)Math.Floor(position.X / 32);
-            int positionY = (int)Math.Floor(position.Y / 32);
-
-            int currentX = gameFunction.getSelectedUnit().getPosition().Item1;
-            int currentY = gameFunction.getSelectedUnit().getPosition().Item2;
-
-            // if new position is different from old position, set unit to new position
-            if (!(gameFunction.getSelectedUnit().getPosition() == new Tuple<int, int>(positionX, positionY)))
+            Unit unit = GameState.getSelectedUnit();
+            
+            // moves the unit to each node in the path (one node at a time)
+            foreach(Node node in path)
             {
-                
-                if (gameFunction.getSelectedUnit().getPosition().Item1 < positionX) { 
-                    for (currentX = gameFunction.getSelectedUnit().getPosition().Item1; currentX <= positionX; currentX++)
-                    {
-                        Thread.Sleep(500);
-                        gameFunction.getSelectedUnit().setPosition(currentX, currentY);
-                        Debug.Write("X is: " + currentX);
-                    }
-                }
-                else
-                {
-                    for (currentX = gameFunction.getSelectedUnit().getPosition().Item1; currentX >= positionX; currentX--)
-                    {
-                        Thread.Sleep(500);
-                        gameFunction.getSelectedUnit().setPosition(currentX, currentY);
-                        Debug.Write("X is: " + currentX);
-                    }
-                }
-                if (gameFunction.getSelectedUnit().getPosition().Item2 < positionY)
-                {
-                    for (currentY = gameFunction.getSelectedUnit().getPosition().Item2; currentY <= positionY; currentY++)
-                    {
-                        Thread.Sleep(500);
-                        gameFunction.getSelectedUnit().setPosition(currentX, currentY);
-                        Debug.Write("Y is: " + currentY);
-                    }
-                }
-                else
-                {
-                    for (currentY = gameFunction.getSelectedUnit().getPosition().Item2; currentY >= positionY; currentY--)
-                    {
-                        Thread.Sleep(500);
-                        gameFunction.getSelectedUnit().setPosition(currentX, currentY);
-                        Debug.Write("Y is: " + currentY);
-                    }
-                }
-
-
-                gameFunction.getSelectedUnit().setClickedOn(false);
+                Thread.Sleep(200);
+                unit.setPosition(node.getPositionX(), node.getPositionY());
             }
         }
 
-        //which dropdownmenu is selected
-        private void buttonAction(int i)
+        // sets which menu option is selected
+        private static void buttonAction(int i)
         {
             // take action corresponding to which button was clicked
             switch (i)
diff --git a/src/Blaze-Brigade/Blaze_Brigade/Node.cs b/src/Blaze-Brigade/Blaze_Brigade/Node.cs
index 7cb9591..f73cf69 100644
--- a/src/Blaze-Brigade/Blaze_Brigade/Node.cs
+++ b/src/Blaze-Brigade/Blaze_Brigade/Node.cs
@@ -10,12 +10,8 @@ namespace Model
     {
         private int movabilityObstruction;  // index for hindrance of the movability of a unit; 0 = no hindrance
         private bool isObstacle;            // indicates whether a unit can stand inside the tile
-        private bool highlightMove;
-        private bool highlightAttack;
-         
         private int positionX;              // position x on the grid
         private int positionY;              // position y on the grid
-        private int nodeType;               // for now 0 = empty, 1 = unit, 2 = obstacle, 3 = terain, 4 = unit + terain.
 
         public Node(int x, int y)
         {
@@ -23,7 +19,6 @@ namespace Model
             positionY = y;
             movabilityObstruction = 0;      // defaults to no hindrance in unit movement
             isObstacle = false;             // default to non-obstacle tile
-            nodeType = 0;                   // initially we create empty nodes...
         }
 
         public void setMovabilityObstruction(int m)
@@ -61,28 +56,5 @@ namespace Model
         {
             return positionY;
         }
-        // Note: when a unit moves to a new square, change old node back to it's original value and update current node.
-        public void setNodeType(int a)
-        {
-            this.nodeType = a;
-        }
-        public int getNodeType()
-        {
-            return this.nodeType;
-        }
-
-        // if the node contains a unit and is within range, then it is attackable.
-        public bool containsUnit()
-        {
-            if (this.nodeType == 1)
-            {
-                return true;
-            }
-            else
-            {
-                return false;
-            }
-        }
-
     }
 }
diff --git a/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs b/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs
index 24da0c4..1709467 100644
--- a/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs
+++ b/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs
@@ -33,7 +33,8 @@ namespace Model
         private Boolean clickedOn = false;
         private Boolean menuOpen = false;
 
-        public Warrior(Texture2D image, Texture2D attackButton, Texture2D moveButton, Texture2D itemButton, Texture2D waitButton, Texture2D charInfo, Vector2 coordinates)
+        public Warrior(Texture2D image, Texture2D attackButton, Texture2D moveButton,
+            Texture2D itemButton, Texture2D waitButton, Texture2D charInfo, Vector2 coordinates)
         {
             // TODO: setup pre-determined stats for warrior
             spriteImage = image;
-- 
GitLab