public void Init() { if (init) { return; } init = true; //if(!enablePerk) return; //loading the perks from DB List <Perk> dbList = PerkDB.Load(); for (int i = 0; i < dbList.Count; i++) { if (!unavailableIDList.Contains(dbList[i].ID)) { Perk perk = dbList[i].Clone(); perkList.Add(perk); } } for (int i = 0; i < perkList.Count; i++) { perkList[i].SetPlayer(player); } StartCoroutine(UnlockPurchasedPerk()); }
public static void CopyFromOldDB() { Init(); if (instance.copiedFromOldDB) { return; } instance.copiedFromOldDB = true; instance.perkList = new List <Perk>(PerkDB.LoadClone1()); }
public static List <Perk> LoadClone1() { PerkDB instance = LoadDB1(); List <Perk> list = new List <Perk>(); for (int i = 0; i < instance.perkList.Count; i++) { list.Add(instance.perkList[i].Clone()); } return(list); }
public static List <Perk> Load() { GameObject obj = Resources.Load("DB_TDSTK/DB_Perk", typeof(GameObject)) as GameObject; #if UNITY_EDITOR if (obj == null) { obj = CreatePrefab(); } #endif PerkDB instance = obj.GetComponent <PerkDB>(); return(instance.perkList); }
public static List <Perk> LoadClone() { GameObject obj = Resources.Load("DB_TDSTK/DB_Perk", typeof(GameObject)) as GameObject; #if UNITY_EDITOR if (obj == null) { obj = CreatePrefab(); } #endif PerkDB instance = obj.GetComponent <PerkDB>(); List <Perk> list = new List <Perk>(); for (int i = 0; i < instance.perkList.Count; i++) { list.Add(instance.perkList[i].Clone()); } return(list); }
public static void LoadPerk() { perkDB = PerkDB.LoadDB(); for (int i = 0; i < perkDB.perkList.Count; i++) { if (perkDB.perkList[i] != null) { //perkDB.perkList[i].ID=i; perkIDList.Add(perkDB.perkList[i].ID); } else { perkDB.perkList.RemoveAt(i); i -= 1; } } UpdateLabel_Perk(); TDSEditorWindow.SetPerkDB(perkDB, perkIDList, perkLabel); TDSEditorInspector.SetPerkDB(perkDB, perkIDList, perkLabel); }
public static void SetPerkDB(PerkDB db, List <int> IDList, string[] label) { perkDB = db; perkIDList = IDList; perkLabel = label; }