/// <summary>
        /// Check if a shape has been created from the queue of inputted buttons
        /// </summary>
        /// <param name="queuedButtons">The queue of buttons to be checked</param>
        /// <returns> The shape that was generated shaped</returns>
        private Defines.GESTURES CheckShape(ref List <Buttons> queuedButtons)
        {
            // Assume that no shape has been generated
            Defines.GESTURES _resultGesture = Defines.GESTURES.NORMAL;

            // NOTE: Start with the "longest" shape [Shape that requires most inputs...then work in decreasing amount of input]
            // This allows us to check if we wanted a square (and not immediately substitute it for a triangle or V)

            // Check for square formation
            if (CheckShape(ref queuedButtons, ref SQUARE_SHAPE_B) == SQUARE_SHAPE_B.Count)
            {
                _resultGesture = Defines.GESTURES.SQUARE;
            }

            // Check for V formation
            else if (CheckShape(ref queuedButtons, ref V_SHAPE_B) == V_SHAPE_B.Count && queuedButtons.Count <= V_SHAPE_B.Count)
            {
                _resultGesture = Defines.GESTURES.V;
            }

            // Check for triangle formation
            else if (CheckShape(ref queuedButtons, ref TRIANGLE_SHAPE_B) == TRIANGLE_SHAPE_B.Count)
            {
                _resultGesture = Defines.GESTURES.TRIANGLE;
            }

            // Check for line formation
            else if (CheckShape(ref queuedButtons, ref LINE_SHAPE_B) == LINE_SHAPE_B.Count && queuedButtons.Count <= LINE_SHAPE_B.Count)
            {
                _resultGesture = Defines.GESTURES.LINE;
            }

            return(_resultGesture);
        }
        /// <summary>
        /// Keeps track of the input of a given player
        /// </summary>
        /// <param name="currentGamePadState">Contains the GamePad whose state is in question</param>
        public void updatePlayerState(GamePadState currentGamePadState)
        {
            //If the system is ready for another direction
            if (currentGamePadState.IsConnected)
            {
                //Clicking in the right thumbstick resets the gesture input
                if (currentGamePadState.Buttons.RightStick == ButtonState.Pressed)
                {
                    queuedButtons.Clear();
                    currentShape = Defines.GESTURES.NORMAL;
                }

                if (queuedButtons.Count >= 2)
                {
                    currentShape = CheckShape(ref queuedButtons);

                    // if we made a change in gesture, reset the queue for the next gesture
                    if (currentShape != Defines.GESTURES.NORMAL)
                    {
                        queuedButtons.Clear();

                        // Also reset the 'B' Button counter
                        B_count = 0;
                    }
                }
                updateButtonState();
            }
        }
        /// <summary>
        /// Updates the current formation to the newly recognized system gesture.
        /// </summary>
        public void UpdateFormation()
        {
            //If the player is triggering a fusion
            if (Defines.playerFusionTriggered[this.currentPlayerIndex])
            {
                //If there is a second player and that player is also in fusion mode
                if (Defines.playersGestures.Count > 1)
                {
                    //Get the index of the other player
                    PlayerIndex _otherPlayer = (this.currentPlayerIndex == PlayerIndex.One) ? PlayerIndex.Two : PlayerIndex.One;

                    //If the other player is in fusion mode and their formation isn't a Normal formation
                    if (Defines.playerFusionTriggered[_otherPlayer])
                    {
                        //Check the ID of the gesture
                        switch (currentFormationID)
                        {
                        case Defines.GESTURES.LINE:
                            currentFormationID = Defines.GESTURES.LINE_FUSION;
                            break;

                        case Defines.GESTURES.SQUARE:
                            currentFormationID = Defines.GESTURES.SQUARE_FUSION;
                            break;

                        case Defines.GESTURES.TRIANGLE:
                            currentFormationID = Defines.GESTURES.TRIANGLE_FUSION;
                            break;

                        case Defines.GESTURES.V:
                            currentFormationID = Defines.GESTURES.V_FUSION;
                            break;
                        }
                        currentFusionFormation = fusionFormationList[currentFormationID];

                        //Set the current formation to the fusion formation for this player
                        currentFormation = currentFusionFormation.playerFormationList[currentPlayerIndex];
                        //Set up the formation manager for a fusion formation.
                        this.StartFusionMode();
                    }
                }
                //Otherwise we need a single-player fusion mode.
                else if (Defines.playersGestures.Count == 1)
                {
                    //TODO: Implement single-player fusion triggering.
                }
            }
            //Otherwise, we're not triggering a fusion,
            //  so just find the regular formation
            else
            {
                currentFormation = formationList[currentFormationID];
            }

            //Set ID to remember gesture
            previousFormationID = currentFormationID;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime, int numShips, Vector2 fixedPoint)
        {
            //Store the changed fixed point
            globalFixedPoint = fixedPoint;

            /*
             * Note: We only want to check for new formation changes when we aren't
             * in fusion mode. If we are in fusion mode, then we check for formations when
             * the fusion timer has expired.
             */
            if (!inFusionMode)
            {
                //Update the gesture component to check for new formations
                gestureComponent.Update(gameTime);

                //Check for new gestures
                currentFormationID = gestureComponent.currentShape;
                if (currentFormationID != previousFormationID)
                {
                    //Update formation positions
                    UpdateFormation();
                }

                //Update the positions of the ships based on the player's fixed point
                currentFormation.Update(gameTime, numShips, globalFixedPoint);
            }
            //Otherwise, we're in a fusion formation
            else
            {
                //Only player one can manipulate the global fusion timer
                if (currentPlayerIndex == PlayerIndex.One)
                {
                    Defines.FusionTimer -= gameTime.ElapsedGameTime;
                }

                if (Defines.FusionTimer <= TimeSpan.Zero)
                {
                    inFusionMode = false;
                }

                currentFusionFormation.Update(gameTime, globalFixedPoint);
                currentFormation = currentFusionFormation.playerFormationList[currentPlayerIndex];
            }
        }
        /// <summary>
        /// Updates the current formation to the newly recognized system gesture.
        /// </summary>
        public void UpdateFormation()
        {
            //If the player is triggering a fusion
            if (Defines.playerFusionTriggered[this.currentPlayerIndex])
            {
                //If there is a second player and that player is also in fusion mode
                if (Defines.playersGestures.Count > 1)
                {
                    //Get the index of the other player
                    PlayerIndex _otherPlayer = (this.currentPlayerIndex == PlayerIndex.One) ? PlayerIndex.Two : PlayerIndex.One;

                    //If the other player is in fusion mode and their formation isn't a Normal formation
                    if (Defines.playerFusionTriggered[_otherPlayer])
                    {
                        //Check the ID of the gesture
                        switch (currentFormationID)
                        {
                            case Defines.GESTURES.LINE:
                                currentFormationID = Defines.GESTURES.LINE_FUSION;
                                break;
                            case Defines.GESTURES.SQUARE:
                                currentFormationID = Defines.GESTURES.SQUARE_FUSION;
                                break;
                            case Defines.GESTURES.TRIANGLE:
                                currentFormationID = Defines.GESTURES.TRIANGLE_FUSION;
                                break;
                            case Defines.GESTURES.V:
                                currentFormationID = Defines.GESTURES.V_FUSION;
                                break;
                        }
                        currentFusionFormation = fusionFormationList[currentFormationID];

                        //Set the current formation to the fusion formation for this player
                        currentFormation = currentFusionFormation.playerFormationList[currentPlayerIndex];
                        //Set up the formation manager for a fusion formation.
                        this.StartFusionMode();
                    }

                }
                //Otherwise we need a single-player fusion mode.
                else if (Defines.playersGestures.Count == 1)
                {
                    //TODO: Implement single-player fusion triggering.
                }

            }
            //Otherwise, we're not triggering a fusion,
            //  so just find the regular formation
            else
                currentFormation = formationList[currentFormationID];

            //Set ID to remember gesture
            previousFormationID = currentFormationID;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime, int numShips, Vector2 fixedPoint)
        {
            //Store the changed fixed point
            globalFixedPoint = fixedPoint;

            /*
             * Note: We only want to check for new formation changes when we aren't
             * in fusion mode. If we are in fusion mode, then we check for formations when
             * the fusion timer has expired.
             */
            if (!inFusionMode)
            {
                //Update the gesture component to check for new formations
                gestureComponent.Update(gameTime);

                //Check for new gestures
                currentFormationID = gestureComponent.currentShape;
                if (currentFormationID != previousFormationID)
                    //Update formation positions
                    UpdateFormation();

                //Update the positions of the ships based on the player's fixed point
                currentFormation.Update(gameTime, numShips, globalFixedPoint);

            }
            //Otherwise, we're in a fusion formation
            else
            {
                //Only player one can manipulate the global fusion timer
                if(currentPlayerIndex == PlayerIndex.One)
                    Defines.FusionTimer -= gameTime.ElapsedGameTime;

                if (Defines.FusionTimer <= TimeSpan.Zero)
                    inFusionMode = false;

                currentFusionFormation.Update(gameTime, globalFixedPoint);
                currentFormation = currentFusionFormation.playerFormationList[currentPlayerIndex];
            }
        }
        /// <summary>
        /// Keeps track of the input of a given player
        /// </summary>
        /// <param name="currentGamePadState">Contains the GamePad whose state is in question</param>
        public void updatePlayerState(GamePadState currentGamePadState)
        {
            //If the system is ready for another direction
            if (currentGamePadState.IsConnected)
            {
                //Clicking in the right thumbstick resets the gesture input
                if (currentGamePadState.Buttons.RightStick == ButtonState.Pressed)
                {
                    queuedButtons.Clear();
                    currentShape = Defines.GESTURES.NORMAL;
                }

                if (queuedButtons.Count >= 2)
                {
                    currentShape = CheckShape(ref queuedButtons);

                    // if we made a change in gesture, reset the queue for the next gesture
                    if (currentShape != Defines.GESTURES.NORMAL)
                    {
                        queuedButtons.Clear();

                        // Also reset the 'B' Button counter
                        B_count = 0;
                    }
                }
                updateButtonState();
            }
        }