Exemple #1
0
    void Start()
    {
        // We copy the GUIAssets to prevent permenant changes to the assets.
        titleScreen_Splash = titleScreen_Splash.Copy();
        titleScreen_Menu   = titleScreen_Menu.Copy();

        // Get the GUIDrawTexture control using the Find<T> method.
        textureControl = titleScreen_Splash.Find <GUIDrawTexture>("Texture");
        // Set the first splash image.
        textureControl.image = splashes[0];

        // Get the buttons using Find<T>.
        buttonNew  = titleScreen_Menu.Find <GUIButton>("New Button");
        buttonLoad = titleScreen_Menu.Find <GUIButton>("Load Button");
        buttonQuit = titleScreen_Menu.Find <GUIButton>("Quit Button");

        // Prepare to display the splash screen.
        splashCounter = 0;
        splashID      = 0;
        showSplash    = true;

        // Prepare the menu to move from below the screen to the center.
        menuEndPosition             = titleScreen_Menu.position;
        titleScreen_Menu.position.x = menuEndPosition.x = (Screen.width - titleScreen_Menu.position.width) / 2;
        titleScreen_Menu.position.y = Screen.height;
        menuEndPosition.y           = (Screen.height - titleScreen_Menu.position.height) / 2;

        // Set the splash screen to the center.
        titleScreen_Splash.position.x = (Screen.width - titleScreen_Splash.position.width) / 2;
        titleScreen_Splash.position.y = (Screen.height - titleScreen_Splash.position.height) / 2;
    }
Exemple #2
0
    void Start()
    {
        // If there is no GUIAsset, exit the method.
        if (!gui)
        {
            return;
        }

        // We copy the GUIAsset
        // because saved assets
        // are persistant. This
        // means that any change
        // to the original GUIAsset
        // will permenantly change
        // the GUIAsset's .asset file.
        gui = gui.Copy();
        // When we copy the GUIAsset,
        // we do not have to worry
        // about damaging the asset
        // in-game. We can experiment
        // with the GUIAsset without
        // affecting the original.
    }