Ejemplo n.º 1
0
        private void InitializeGameMan(Scene scene, LoadSceneMode mode)
        {
            // TODO: load player unlocks from savefile and pass them to PlayerManager and other player progress and stuff.
            string scneneName = scene.name;

            switch (scneneName)
            {
            case GlobalVariables.MAIN_MENU:
                //print("mainmenu init");
                MainMenuInit();
                break;

            case GlobalVariables.GRAVEYARD:
                //print("graveyard init");

                //#if (UNITY_EDITOR)
                // Load PlayerMan, move to GraveyardInit?
                if (PlayerManager == null)
                {
                    PlayerManager = GetComponent <PlayerManager>();
                }

                PlayerManager.Initialize(SaveSystem, SaveUtils.PLAYER_MAN_PREFIX);

                // Load GraveyardMan
                if (GraveyardManager == null)
                {
                    GraveyardManager = FindObjectOfType <GraveyardManager>();
                }

                GraveyardManager.Initialize(SaveSystem, SaveUtils.GRAVEYARD_MAN_PREFIX);

                // Load AIman, move to GraveyardInit?
                if (AIManager == null)
                {
                    AIManager = GetComponent <AIManager>();
                }

                AIManager.Initialize(SaveSystem, SaveUtils.AI_MAN_PREFIX);
                //#endif

                StartCoroutine(GraveyardInit());
                break;

            case GlobalVariables.CASTLE:
                if (PlayerManager == null)
                {
                    PlayerManager = GetComponent <PlayerManager>();
                }

                PlayerManager.Initialize(SaveSystem, SaveUtils.PLAYER_MAN_PREFIX);

                // Load GraveyardMan
                if (CastleManager == null)
                {
                    CastleManager = FindObjectOfType <CastleManager>();
                }

                CastleManager.Initialize(SaveSystem, SaveUtils.CASTLE_MAN_PREFIX);

                // Load AIman, move to GraveyardInit?
                if (AIManager == null)
                {
                    AIManager = GetComponent <AIManager>();
                }

                AIManager.Initialize(SaveSystem, SaveUtils.AI_MAN_PREFIX);

                StartCoroutine(CastleInit());
                break;

#if (UNITY_EDITOR)
            case "SampleScene 1":
                // Load PlayerMan, move to GraveyardInit?
                if (PlayerManager == null)
                {
                    PlayerManager = GetComponent <PlayerManager>();
                }

                PlayerManager.Initialize(SaveSystem, SaveUtils.PLAYER_MAN_PREFIX);

                // Load GraveyardMan
                if (GraveyardManager == null)
                {
                    GraveyardManager = FindObjectOfType <GraveyardManager>();
                }

                GraveyardManager.Initialize(SaveSystem, SaveUtils.GRAVEYARD_MAN_PREFIX);

                // Load AIman, move to GraveyardInit?
                if (AIManager == null)
                {
                    AIManager = GetComponent <AIManager>();
                }

                AIManager.Initialize(SaveSystem, SaveUtils.AI_MAN_PREFIX);

                StartCoroutine(GraveyardInit());
                break;
#endif
            case GlobalVariables.OUTRO:
                Settings.Instance.Audio.ChangeMusic(AudioContainer.Music.Menu);
                break;
            }
        }