Exemple #1
0
    /// <summary>
    /// Sets up manager components to be accessed
    /// </summary>
    private void Start()
    {
        if (PlayerPrefs.GetInt("hasLoaded") == 0)
        {
            PlayerPrefs.SetInt("hasLoaded", 1);
            firstTimeLoading = false;
        }
        else
        {
            firstTimeLoading = false;
        }

        Time.timeScale = 0;

        // If was instanced
        if (instance != null)
        {
            // Initialize manager
            Initialize();

            SetupPlayer();

            // get object pool manager
            if (objectPoolManager == null)
            {
                objectPoolManager = GetComponent <ObjectPoolManager>();
            }

            // get map manager
            if (mapManager == null)
            {
                mapManager = GetComponent <MapManager>();
            }

            // get audio manager
            if (audioManager == null)
            {
                audioManager = GetComponent <AudioManager>();
            }

            // get Unload manager
            if (unloadObjects == null)
            {
                unloadObjects = GetComponent <UnloadObjects>();
            }

            if (tutorialManager == null)
            {
                tutorialManager = GetComponent <TutorialManager>();
            }

            // Make menu show up
            __event <e_UI> .InvokeEvent(this, e_UI.MENU, false);

            __event <e_UI_TUTRIAL> .InvokeEvent(this, e_UI_TUTRIAL.NULL);

            // Set timeout to never
            Screen.sleepTimeout = SleepTimeout.NeverSleep;

            coinSP = GameObject.FindGameObjectWithTag("CoinSP");
        }
    }