//Pump Animation function. Controls the current characters animation synced with the animation of the pump handle.
    IEnumerator DoPumpAnimation(int time)
    {
        //Initializes target for animation to avoid null values being past through. Defaults to the Player.
        GRHBalloonMG_AnimationController.AnimationObject target = GRHBalloonMG_AnimationController.AnimationObject.Player;

        //Sets the target to the current character who will be pumping the balloon.
        switch (currentGameState)
        {
        case BalloonPopGameStates.PlayerTurn:
            target = GRHBalloonMG_AnimationController.AnimationObject.Player;
            break;

        case BalloonPopGameStates.AI1Turn:
            target = GRHBalloonMG_AnimationController.AnimationObject.AI1;
            break;

        case BalloonPopGameStates.AI2Turn:
            target = GRHBalloonMG_AnimationController.AnimationObject.AI2;
            break;

        case BalloonPopGameStates.AI3Turn:
            target = GRHBalloonMG_AnimationController.AnimationObject.AI3;
            break;

        default:
            break;
        }

        //Begins the pump animation sequence for the target character and their state, and the pumps animation state.
        animationController.ControlPumpAnimations(target, true, 2);

        //Starts the balloon inflation animation
        StartCoroutine(animationController.IncreaseSizeOfBalloon(maxBalloonPumps, time));

        yield return(new WaitForSeconds(time - 0.17f));

        //Stops the pump animation sequence for the target character and their state, and the pumps animation state.
        animationController.ControlPumpAnimations(target, false, 0);

        StartCoroutine(EndTurn());
    }
    //End of turn function. Determines whether the game has ended, the animation to play, and who the next player is.
    IEnumerator EndTurn()
    {
        //Set up the variables for animations. We default these to prevent compiler errors from the switch statements not liking us handling every case.
        GRHBalloonMG_AnimationController.AnimationObject   target1 = GRHBalloonMG_AnimationController.AnimationObject.Player, target2 = GRHBalloonMG_AnimationController.AnimationObject.Player;
        GRHBalloonMG_AnimationController.AnimationLocation destination1 = GRHBalloonMG_AnimationController.AnimationLocation.Pump, destination2 = GRHBalloonMG_AnimationController.AnimationLocation.Pump;

        //First off, has the game ended?
        if (HasGameFinished())
        {
            //It has. That means the character currently at the pump needs to be taken away as a single movement. Determine the character to be moved.
            //We can find this by whose turn it currently is.
            switch (currentGameState)
            {
            case BalloonPopGameStates.PlayerTurn:
                target1    = GRHBalloonMG_AnimationController.AnimationObject.Player;
                endMessage = "You Lose";
                break;

            case BalloonPopGameStates.AI1Turn:
                target1    = GRHBalloonMG_AnimationController.AnimationObject.AI1;
                endMessage = "You Win";
                PlayConfettiEffect();     // - Added by Adam
                break;

            case BalloonPopGameStates.AI2Turn:
                target1    = GRHBalloonMG_AnimationController.AnimationObject.AI2;
                endMessage = "You Win";
                PlayConfettiEffect();
                break;

            case BalloonPopGameStates.AI3Turn:
                target1    = GRHBalloonMG_AnimationController.AnimationObject.AI3;
                endMessage = "You Win";
                PlayConfettiEffect();
                break;

            default:
                Debug.Log("Game manager's end turn is calling for a non-existent player.");
                break;
            }

            //The destination will be the same regardless of who it is.
            destination1 = GRHBalloonMG_AnimationController.AnimationLocation.StartingLocation;

            //Now, start the animation, and wait for the right amount of time.
            animationController.MoveSingleCharacterToLocation(target1, destination1);
            yield return(new WaitForSeconds(animationController.GetTimeForSingleMovement()));

            //Now, we call EndGame.
            EndGame();
        }
        else
        {
            //Determine the first target and their destination.
            switch (currentGameState)
            {
            case BalloonPopGameStates.PlayerTurn:
                //If we're in the player state, and the player was knocked out, it would be picked up in the HasGameEnded check earlier.
                //Therefore, if it's the player's turn, we're returning them to their position.
                target1      = GRHBalloonMG_AnimationController.AnimationObject.Player;
                destination1 = GRHBalloonMG_AnimationController.AnimationLocation.PlayerLocation;

                //Determine the next game state.
                currentGameState = DetermineNextActivePlayer(0);
                break;

            case BalloonPopGameStates.AI1Turn:
                //First target is AI 1.
                target1 = GRHBalloonMG_AnimationController.AnimationObject.AI1;

                if (activePlayers[1])
                {
                    //AI 1 is still active. Return them to their normal location.
                    destination1 = GRHBalloonMG_AnimationController.AnimationLocation.AI1Location;
                }
                else
                {
                    //AI 1 was knocked out. Put them off the screen.
                    destination1 = GRHBalloonMG_AnimationController.AnimationLocation.StartingLocation;
                    StartCoroutine(PlayCrunchSoundEffect());
                }

                //Determine the next game state.
                currentGameState = DetermineNextActivePlayer(1);
                break;

            case BalloonPopGameStates.AI2Turn:
                //First target is AI 2.
                target1 = GRHBalloonMG_AnimationController.AnimationObject.AI2;

                if (activePlayers[2])
                {
                    //AI 2 is still active. Return them to their normal location.
                    destination1 = GRHBalloonMG_AnimationController.AnimationLocation.AI2Location;
                }
                else
                {
                    //AI 2 was knocked out. Put them off the screen.
                    destination1 = GRHBalloonMG_AnimationController.AnimationLocation.StartingLocation;
                    StartCoroutine(PlayCrunchSoundEffect());
                }

                //Determine the next game state.
                currentGameState = DetermineNextActivePlayer(2);
                break;

            case BalloonPopGameStates.AI3Turn:
                //First target is AI 3.
                target1 = GRHBalloonMG_AnimationController.AnimationObject.AI3;

                if (activePlayers[3])
                {
                    //AI 3 is still active. Return them to their normal location.
                    destination1 = GRHBalloonMG_AnimationController.AnimationLocation.AI3Location;
                }
                else
                {
                    //AI 3 was knocked out. Put them off the screen.
                    destination1 = GRHBalloonMG_AnimationController.AnimationLocation.StartingLocation;
                    StartCoroutine(PlayCrunchSoundEffect());
                }

                //Determine the next game state.
                currentGameState = DetermineNextActivePlayer(3);
                break;

            default:
                Debug.Log("Game manager's end turn is checking a non-existent player.");
                break;
            }

            //Now, using our new game state, determine the second target.
            switch (currentGameState)
            {
            case BalloonPopGameStates.PlayerTurn:
                target2 = GRHBalloonMG_AnimationController.AnimationObject.Player;
                break;

            case BalloonPopGameStates.AI1Turn:
                target2 = GRHBalloonMG_AnimationController.AnimationObject.AI1;
                break;

            case BalloonPopGameStates.AI2Turn:
                target2 = GRHBalloonMG_AnimationController.AnimationObject.AI2;
                break;

            case BalloonPopGameStates.AI3Turn:
                target2 = GRHBalloonMG_AnimationController.AnimationObject.AI3;
                break;

            default:
                Debug.Log("Game manager's end turn is checking a non-existent player.");
                break;
            }

            //Update the balloon pump count display if difficulty is set to easy
            if (GRHGameSettings.gameSettings.gameDifficulty == "EASY")
            {
                balloonPumpsLeftText.text = $"{maxBalloonPumps - currentBalloonPumps}";
            }

            //The second destination is always the same.
            destination2 = GRHBalloonMG_AnimationController.AnimationLocation.Pump;

            //Now, start the animation, and wait the proper amount of time.
            animationController.MoveDoubleCharacterToLocations(target1, destination1, target2, destination2);
            yield return(new WaitForSeconds(animationController.GetTimeForDoubleMovement()));

            //Animation has played. If this is the player turn, show the UI. Otherwise, advance the game.
            if (currentGameState == BalloonPopGameStates.PlayerTurn)
            {
                ShowPlayerUI();
            }
            else
            {
                AdvanceGame();
            }
        }
    }