public void FadeAlphaToBlack()
    {
        // Make sure the texture is enabled.
        myGUITexture.enabled = true;

        currentState = screenFaderState.alphaToBlack;
    }
    void Update()
    {
        switch (currentState)
        {
        case screenFaderState.idle:
            return;

        case screenFaderState.blackToAlpha:
            FadeToClear();
            if (myGUITexture.color.a <= fadeBoundary)
            {
                // When the screen is almost clear, set the colour to clear and disable the GUITexture.
                myGUITexture.color   = Color.clear;
                myGUITexture.enabled = false;
                currentState         = screenFaderState.idle;
            }
            return;

        case screenFaderState.alphaToBlack:
            FadeToBlack();
            if (myGUITexture.color.a >= (1 - fadeBoundary))
            {
                // When the screen is almost black
                myGUITexture.color   = Color.black;
                myGUITexture.enabled = false;
                currentState         = screenFaderState.idle;
                gameController.ScreenCompletelyBlack();
            }
            return;
        }
    }
    public void FadeBlackToAlpha()
    {
        // Make sure the texture is enabled.
        myGUITexture.enabled = true;

        currentState = screenFaderState.blackToAlpha;
    }
    // Awake is called before any Start Methods
    void Awake()
    {
        myGUITexture = GetComponent <GUITexture>();

        // Set the texture so that it is the the size of the screen and covers it
        // note: this returns 955 x 485 for the DK 2, which is not the real display size
        // myGUITexture.pixelInset = new Rect(0f, 0f, Screen.width, Screen.height);

        myGUITexture.pixelInset = new Rect(0f, 0f, screenWidth, screenHeight);

        currentState = screenFaderState.idle;
    }