void OnGUI()
        {
            ScreenH    = Screen.height;
            ScreenW    = Screen.width;
            scoreLeft  = gameManager.player1Score;
            scoreRight = gameManager.player2Score;
            if (gameManager.player1Score > totalScore)
            {
                gameManager.player1Score = totalScore;
            }
            if (gameManager.player2Score > totalScore)
            {
                gameManager.player2Score = totalScore;
            }
            GUIstatus = stateManager.status;
            switch (GUIstatus)
            {
            case WorldGameState.Pause:
                PauseButton();
                break;

            case WorldGameState.InGame:
                InGameGUI();
                break;

            case WorldGameState.Purgatory:
                PurgatoryGUI();
                break;

            case WorldGameState.EndGame:
                EndGameGUI();
                break;
            }
        }
 // this controls camera pos and passes the state to the GUI manager
 void Start()
 {
     status     = WorldGameState.InGame;
     MainCamera = Camera.main;
     color1     = MainCamera.backgroundColor;
     color2     = Color.white;
 }
 //---------------------------------------------------------------------------
 // plays the logo animation and fades the camera color from grey to white for 6.25 seconds
 private void SplashScreenState()
 {
     deltaTime += Time.deltaTime * 0.08f;
     if (deltaTime < duration)
     {
         GetComponent <Camera>().backgroundColor = Color.Lerp(color1, color2, deltaTime);
     }
     if (Time.realtimeSinceStartup > 5.45)
     {
         status = WorldGameState.StartMenu;
     }
 }
        //-----------------------------------------------------------------------------
        private void InGameGUI()
        {
            //this code is to make the button a independent of resolution
            if (gameManager.player1Score == totalScore)
            {
                abilityButtons();
            }
            Rect MenuButtonRect = new Rect((float)(ScreenW * .01), (float)(ScreenH - (ScreenH * .01 + (float)(ScreenW * .030))),
                                           (float)(ScreenW * .030), (float)(ScreenW * .030));

            if (GUI.Button(MenuButtonRect, "", GearIconStyle))
            {
                //set the last state to pull up the correct menu
                audioManager.playGUI();
                lastState           = stateManager.status;
                stateManager.status = WorldGameState.Pause;
            }

            scoreLeft /= totalScore;
            scoreLeft *= (float)(ScreenW * .35);
            float endLeft = (float)(ScreenW * .35);

            if (currentLeft < scoreLeft && currentLeft < endLeft)
            {
                currentLeft++;
            }
            if (currentLeft > scoreLeft)
            {
                currentLeft--;
            }
            Rect UnderLeftRect = new Rect((float)(ScreenW * .02),
                                          (float)(ScreenH * .015), currentLeft, (float)(ScreenH * .05));

            // change the style if the energy bar is filled
            if (gameManager.player1Score < totalScore)
            {
                GUI.Box(UnderLeftRect, "", LeftEnergyBar);
            }
            else if (gameManager.player1Score == totalScore)
            {
                GUI.Box(UnderLeftRect, "", LeftEnergyBarFilled);
            }
            Rect ScoreCountLeftRect = new Rect((float)(ScreenW * .025),
                                               (float)(ScreenH * .07), (float)(ScreenW * .1), (float)(ScreenH * .05));

            if (gameManager.player1Score != totalScore)
            {
                GUI.Box(ScoreCountLeftRect, gameManager.player1Score.ToString() + " / " + totalScore.ToString(), CountLeft);
            }
            else if (gameManager.player1Score == totalScore)
            {
                GUI.Box(ScoreCountLeftRect, "Ready!", CountLeft);
            }
            Rect EnergyBarLeftRect = new Rect((float)(ScreenW * .02),
                                              (float)(ScreenH * .015), (float)(ScreenW * .35), (float)(ScreenH * .05));

            GUI.Box(EnergyBarLeftRect, "", EnergyBarBorder);
            scoreRight /= totalScore;             //get a percent of the total score
            scoreRight *= (float)(ScreenW * .35); //multiply that percent by the size of the energy bar
            float endRight = (float)(ScreenW * .35);

            StartRight  = (float)((ScreenW * .53) + (ScreenW * .35));
            StartRight -= currentRight;
            if (currentRight < scoreRight && currentRight < endRight && !(currentRight >= endRight))
            {
                currentRight++;
            }
            else if (currentRight > scoreRight)
            {
                currentRight--;
            }
            StartRight  = (float)((ScreenW * .63) + (ScreenW * .35));
            StartRight -= currentRight;

            Rect UnderRightRect = new Rect(StartRight, (float)(ScreenH * .015), currentRight, (float)(ScreenH * .05));
            // change the style if the energy bar is filled

            /*
             * if(gameManager.player2Score < totalScore)
             *  GUI.Box (UnderRightRect, "",RightEnergyBar);
             * else if(gameManager.player2Score == totalScore)
             *  GUI.Box (UnderRightRect, "",RightEnergyBarFilled);
             * Rect ScoreCountRightRect = new Rect ((float)(ScreenW * .875),
             *                                  (float)(ScreenH * .07), (float)(ScreenW * .1), (float)(ScreenH * .05));
             * if(gameManager.player2Score != totalScore)
             *  GUI.Box (ScoreCountRightRect,gameManager.player2Score.ToString()+" / "+totalScore.ToString(), CountRight);
             * else if(gameManager.player2Score == totalScore)
             *  GUI.Box (ScoreCountRightRect,"Ready!", CountRight);
             * Rect EnergyBarRightRect = new Rect ((float)(ScreenW * .63),
             *                                  (float)(ScreenH * .015), (float)(ScreenW * .35), (float)(ScreenH * .05));
             * GUI.Box (EnergyBarRightRect, "", EnergyBarBorder);
             * */
        }
 //---------------------------------------------------------------------------
 private void QuitState()
 {
     status = WorldGameState.StartMenu;
 }
 public BackgroundDisplayTile(WorldGameState gameState)
 {
     _gameState = gameState;
 }