// Use this for initialization
    void Start()
    {
        // Try to get the main UI thingy
        try
        {
            buttons = GameObject.FindGameObjectWithTag("MainUI").GetComponent <MainMenuButtons>();
        }
        // If that doesn't work,
        catch
        {
            // Get the other UI manager thingy
            try
            {
                options = GameObject.FindGameObjectWithTag("OptionsUI").GetComponent <OptionsMenuManager>();
            }
            // and if that doesnt work,
            catch
            {
                // do nothing hahahaa
            }
        }


        // Try to steal the duration from the main UI thingy
        try
        {
            duration = buttons.duration;
        }
        // If that doesn't work,
        catch
        {
            // Try stealing it from the other thing
            try
            {
                duration = options.duration;
            }
            // and if that doesn't work somehow,
            catch
            {
                // do nothing hehehehe
            }
        }

        // get the recttransform to change the position later
        pos = (RectTransform)gameObject.transform;
    }
Beispiel #2
0
    void SceneChanged(Scene scene, LoadSceneMode mode)
    {
        if (mode != LoadSceneMode.Single)
        {
            return;
        }

        if (scene == SceneManager.GetSceneByName("new_game"))
        {
            newGame = GameObject.Find("NewGameManager").GetComponent <NewGameManager>();
        }

        if (scene == SceneManager.GetSceneByName("options_menu"))
        {
            options = GameObject.Find("OptionsManager").GetComponent <OptionsMenuManager>();
        }

        if (scene == SceneManager.GetSceneByName("options_menu"))
        {
        }
        else if (scene == SceneManager.GetSceneByName("new_game"))
        {
            starData    = (options.getData()).ToList();
            playerCount = int.Parse(starData[2]) + 1;
        }

        if (scene == SceneManager.GetSceneByName("new_game"))
        {
        }
        else if (scene == SceneManager.GetSceneByName("main"))
        {
            newData   = (newGame.getData()).ToList();
            generator = GetComponent <StarGenerator>();
            InitGame();
        }
    }