private void LoadItems() { if (items != null && items.Count > 0) { for (int i = 0; i < items.Count; i++) { Item item = items[i]; SavedItem savedItem = BinaryPrefs.GetClass <SavedItem>(item.id.ToString()); if (savedItem != null) { items[i].LoadFrom(savedItem); } } } else { Debug.LogWarning("There is no item in your game ! Please verify that everything is setup correctly", this); } LoadPack(); if (!IsInitialized) { IsInitialized = true; onInitializeSuccess?.Invoke(); } }
/// <summary> /// Method used to load the information from the _savedItem /// </summary> /// <param name="_savedItem"></param> public override void LoadFrom(SavedItem _savedItem) { if (!(_savedItem is SavedCurrency savedCurrency)) { return; } SetValue(savedCurrency.value); }
/// <summary> /// Method used to load the information from the _savedItem as SavedSkin /// </summary> /// <param name="_savedItem"></param> public override void LoadFrom(SavedItem _savedItem) { if (!(_savedItem is SavedSkin savedSkin)) { return; } isCollected = savedSkin.isCollected; isUsed = savedSkin.isUsed; }
/// <summary> /// Method used to load the information from the _savedItem /// </summary> /// <param name="_savedItem"></param> public abstract void LoadFrom(SavedItem _savedItem);