// Update is called once per frame
    void Update()
    {
        //Only allow the scroll wheel to change states in combat mode
        if (state != States.WASD && !movement.isMoving && active)
        {
            if (Input.GetAxis("Mouse ScrollWheel") > 0 || Input.GetKeyDown(KeyCode.UpArrow))
            {
                ScrollWheel(true);
            }
            else if (Input.GetAxis("Mouse ScrollWheel") < 0 || Input.GetKeyDown(KeyCode.DownArrow))
            {
                ScrollWheel(false);
            }
        }

        //Checks to see if you hit the left mouse button
        if (Input.GetMouseButtonDown(0) && state == States.Shielding && active)
        {
            //Makes sure you can only have one shield
            if (!shieldActive)
            {
                if (remainingMana >= 40) //Checks if the player has enough mana to get a shield
                {
                    //Subtract mana
                    hud.DecreaseManaBar(40);
                    //Activates the shield
                    shieldActive = true;
                    //Disables the visable shield
                    shield.SetActive(false);
                    //Updates the hudhealth, which essentially adds another
                    hud.HUDHealth();
                    //Updates player stats
                    hud.DisplayStats();
                    //Play Shield Sound
                    PlayPlayerSounds(1);
                }
                else
                {
                    StartCoroutine(hud.DisplayError("Not Enough Mana"));
                }
            }
            else
            {
                //Ya' Done Gooof'd!
                StartCoroutine(hud.DisplayError("Already Have a Shield"));
            }
        }

        //Checks if the player should level up
        if (playerXP >= 100)
        {
            //Removes the xp and adds to the player level
            playerXP -= 100;
            playerLevel++;
            Debug.Log($"Level: {playerLevel}");
            canAttack = false;

            //pause game and show level up screen
            levelUp.PlayLevelSound(2);
            levelUpMenu.SetActive(true);
            Time.timeScale = 0f;
        }

        if (health == 0 && gameOver.activeSelf == false)
        {
            //Show game over screen and pause the game
            gameOver.SetActive(true);
            Time.timeScale = 0f;
            //Resets the level up info should we game over.
            playerLevel      = savedPlayerLevel;
            playerXP         = savedPlayerXP;
            attack.spellCost = attack.savedSpellCost;
            attack.damage    = attack.savedDamage;
        }

        if (active && Input.GetKeyDown(KeyCode.Return) && !movement.isMoving)
        {
            //Reset line and destroy hitbox and disable shield
            movement.line.positionCount = 0;
            Destroy(attack.hitbox);
            shield.SetActive(false);

            turn.SwitchTurn();
        }
    }