Ejemplo n.º 1
0
        public void Init()
        {
            if (init)
            {
                return;
            }
            init = true;

            if (instance == null)
            {
                instance = this;
            }

            //loading the perks from DB
            List <Perk> dbList = PerkDB.Load();

            for (int i = 0; i < dbList.Count; i++)
            {
                if (!unavailableIDList.Contains(dbList[i].prefabID))
                {
                    Perk perk = dbList[i].Clone();
                    perkList.Add(perk);
                }
            }

            InitPerkProgress();
        }
Ejemplo n.º 2
0
        public static List <Perk> Load()
        {
            GameObject obj = Resources.Load("DB_TBTK/PerkDB", typeof(GameObject)) as GameObject;

                        #if UNITY_EDITOR
            if (obj == null)
            {
                obj = CreatePrefab();
            }
                        #endif

            PerkDB instance = obj.GetComponent <PerkDB>();
            return(instance.perkList);
        }
Ejemplo n.º 3
0
        public static List <Perk> LoadClone()
        {
            GameObject obj = Resources.Load("DB_TBTK/PerkDB", 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);
        }
Ejemplo n.º 4
0
        public static void LoadPerk()
        {
            perkDB = PerkDB.LoadDB();

            for (int i = 0; i < perkDB.perkList.Count; i++)
            {
                if (perkDB.perkList[i] != null)
                {
                    perkIDList.Add(perkDB.perkList[i].prefabID);
                }
                else
                {
                    perkDB.perkList.RemoveAt(i);      i -= 1;
                }
            }

            UpdateLabel_Perk();

            TBEditorWindow.SetPerkDB(perkDB, perkIDList, perkLabel);
            TBEditorInspector.SetPerkDB(perkDB, perkIDList, perkLabel);
        }
Ejemplo n.º 5
0
 public static void SetPerkDB(PerkDB db, List <int> IDList, string[] label)
 {
     perkDB     = db;
     perkIDList = IDList;
     perkLabel  = label;
 }