void Start() { GlobalControl.Instance.InitializeSceneList(); if (GlobalControl.Instance.IsSceneBeingLoaded || GlobalControl.Instance.IsSceneBeingTransitioned) { SavedDroppableList localList = GlobalControl.Instance.GetListForScene(); if (localList != null) { print("Saved potions count: " + localList.SavedPotions.Count); for (int i = 0; i < localList.SavedPotions.Count; i++) { GameObject spawnedPotion = (GameObject)Instantiate(PotionPrefab); spawnedPotion.transform.position = new Vector3(localList.SavedPotions[i].PositionX, localList.SavedPotions[i].PositionY, localList.SavedPotions[i].PositionZ); } for (int i = 0; i < localList.SavedSword.Count; i++) { GameObject spawnedSword = (GameObject)Instantiate(SwordPrefab); spawnedSword.transform.position = new Vector3(localList.SavedSword[i].PositionX, localList.SavedSword[i].PositionY, localList.SavedSword[i].PositionZ); } } else { print("Local List was null!"); } } }
public void InitializeSceneList() { if (SavedLists == null) { print("Saved lists was null"); SavedLists = new List <SavedDroppableList>(); } bool found = false; //We need to find if we already have a list of saved items for this level: for (int i = 0; i < SavedLists.Count; i++) { if (SavedLists[i].SceneID == SceneManager.GetActiveScene().buildIndex) { found = true; print("Scene was found in saved lists!"); } } //If not, we need to create it: if (!found) { SavedDroppableList newList = new SavedDroppableList(SceneManager.GetActiveScene().buildIndex); SavedLists.Add(newList); print("Created new list!"); } }
public void InitializeSceneList() { if (SavedLists == null) { print("Saved lists was null"); SavedLists = new List<SavedDroppableList>(); } bool found = false; //We need to find if we already have a list of saved items for this level: for (int i = 0; i < SavedLists.Count; i++) { if (SavedLists[i].SceneID == SceneManager.GetActiveScene().buildIndex) { found = true; print("Scene was found in saved lists!"); } } //If not, we need to create it: if (!found) { SavedDroppableList newList = new SavedDroppableList(SceneManager.GetActiveScene().buildIndex); SavedLists.Add(newList); print("Created new list!"); } }