void Start()
    {
        player = null;
        levels.Clear();

        // Technically we're still loading...
        // LocateAndUpdateCollectablesAndInteractables();

        // Populate levels
        foreach (AreaController level in ExtendList.FindObjectsOfTypeInactive <AreaController>())
        {
            //levelsParent.GetComponentsInChildren<Level>(true)) {

            levels.Add(level);
        }

        #if UNITY_EDITOR
        FindPlayer();
        #endif


        if (backgroundPlane == null)
        {
            backgroundPlane = GameObject.Find("BackgroundPlane").GetComponent <pb_Object>();
        }
    }
    void ApplySaveData(Scene scene, LoadSceneMode mode)
    {
        FindPlayer();

        // Editor function as loadedFromMainMenu will never be false in production.
        if (LoadSaveController.loadedFromMainMenu == false)
        {
            LoadSaveController.SaveGameLocation = "saveGameTest.xml";
        }

        if (LoadSaveController.SaveGameLocation == "")
        {
            Debug.Log("LoadSaveController.SaveGameLocation");

            hasFullyLoaded = true;
            return;
        }

        SaveGameName = LoadSaveController.LoadedSaveName;
        player.transform.position = (LoadSaveController.loadedFromMainMenu == false) ? GameStartLocation.transform.position : LoadSaveController.LoadedPosition; //LoadSaveController.LoadedPosition;
        TotalTimePlayed           = LoadSaveController.LoadedTotalTime;

        // Populate Collectable list.
        foreach (Collectable collectable in ExtendList.FindObjectsOfTypeInactive <Collectable>())
        {
            foreach (CollectableSave savedCollectable in LoadSaveController.LoadedCollectables)
            {
                if (collectable.CollectableID == savedCollectable.CollectableID)
                {
                    collectable.CollectableCollected = savedCollectable.CollectableCollected;
                    break;
                }
            }
        }

        // Populate Interactable list.
        foreach (Interactable interactable in ExtendList.FindObjectsOfTypeInactive <Interactable>())
        {
            foreach (InteractableSave savedInteractable in LoadSaveController.LoadedInteractables)
            {
                if (savedInteractable.InteractableID == interactable.InteractableID)
                {
                    interactable.IsActivated = savedInteractable.IsActivated;
                    interactable.IsDisabled  = savedInteractable.IsDisabled;
                    interactable.IsLocked    = savedInteractable.IsLocked;
                    break;
                }
            }
        }

        hasFullyLoaded = true;
    }
Example #3
0
        public static void Main()
        {
            ExtendList<string> strList = new ExtendList<string>();
            ListSyncronizer<string> syncStrList = new ListSyncronizer<string>();

            List<string> targetList = new List<string>();

            // 同期対象のリストを割当
            syncStrList.Target = targetList;

            // イベントハンドリング(変更するリストのイベントをハンドリング)
            strList.Changed += new EventHandler<ItemChangedEventArgs<string>>(syncStrList.Handler);

            // リストに何か変更を加える
            strList.Add("AAA");
            strList.Add("BBB");

            // 同期対象が同期されているか検証
            foreach (string value in targetList)
            {
                Console.WriteLine(value);
            }
        }