Exemple #1
0
    private void OnLevelWasLoaded()
    {
                #if !UNITY_WEBPLAYER
        if (saveData != null)
        {
            if (GameObject.FindWithTag(Tags.gameEngine))
            {
                if (GameObject.FindWithTag(Tags.gameEngine).GetComponent <Dialog>())
                {
                    Dialog dialog = GameObject.FindWithTag(Tags.gameEngine).GetComponent <Dialog>();
                    dialog.KillDialog();
                }

                if (GameObject.FindWithTag(Tags.gameEngine).GetComponent <PlayerInteraction>())
                {
                    PlayerInteraction playerInteraction = GameObject.FindWithTag(Tags.gameEngine).GetComponent <PlayerInteraction>();
                    playerInteraction.StopInteraction();
                }
            }

            ReturnMainData();
            levelStorage.ReturnCurrentLevelData();

            if (GameObject.FindWithTag(Tags.gameEngine) && GameObject.FindWithTag(Tags.gameEngine).GetComponent <SceneSettings>())
            {
                SceneSettings sceneSettings = GameObject.FindWithTag(Tags.gameEngine).GetComponent <SceneSettings>();
                sceneSettings.OnLoad();
            }
        }

        saveData = null;
                #endif
    }
Exemple #2
0
    private void Start()
    {
        if (GameObject.FindWithTag(Tags.persistentEngine) && GameObject.FindWithTag(Tags.persistentEngine).GetComponent <SaveSystem>())
        {
            SaveSystem saveSystem = GameObject.FindWithTag(Tags.persistentEngine).GetComponent <SaveSystem>();

            LevelStorage levelStorage = saveSystem.GetComponent <LevelStorage>();
            if (levelStorage)
            {
                levelStorage.ReturnCurrentLevelData();
            }

            if (!saveSystem.isLoadingNewScene)
            {
                FindPlayerStart();
            }
            else
            {
                saveSystem.isLoadingNewScene = false;
            }
        }
    }