Exemplo n.º 1
0
    public void VerifyingList()
    {
        Undo.SetSnapshotTarget(pm, "PerkManager");

        List <Perk> list = PerkEditorWindow.Load();

        int n = 0;

        foreach (Perk perk in pm.allPerkList)
        {
            if (perk.enableInlvl)
            {
                n += 1;
            }
        }
        int m = 0;

        foreach (Perk perk in list)
        {
            if (perk.enableInlvl)
            {
                m += 1;
            }
        }

        for (int i = 0; i < list.Count; i++)
        {
            Perk perk = list[i];
            foreach (Perk p in pm.allPerkList)
            {
                if (perk.ID == p.ID)
                {
                    //~ if(perk.name=="CanonTower") Debug.Log(perk.name+"   "+p.unlocked);
                    //~ Debug.Log(p.ID+"  "+p.name+"    "+p.enableInlvl);
                    perk.enableInlvl = p.enableInlvl;
                    perk.unlocked    = p.unlocked;
                }
            }
        }

        pm.allPerkList = list;
        EditorUtility.SetDirty(pm);

        Undo.CreateSnapshot();
        Undo.RegisterSnapshot();
        Undo.ClearSnapshotTarget();
    }