Example #1
0
 protected void UpdateSkillTreeState()
 {
     for (int i = 0; i < Patch.SkillTreeSize; i++)
     {
         if (CachedTreeSkills[i].GetType().IsSubclassOf(typeof(ActiveSkill)))
         {
             ActiveSkill active = GetActive(CachedTreeSkills[i].GetType());
             if (active && PlayerData.SkillTreelvls[i] != 0)
             {
                 active.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]);
             }
             else if (active && PlayerData.SkillTreelvls[i] == 0)
             {
                 Actives.Remove(active);
                 active.Delete();
             }
             else if (active == null && PlayerData.SkillTreelvls[i] != 0)
             {
                 Skill s = CachedTreeSkills[i].Instantiate();
                 s.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]);
                 Actives.Add((ActiveSkill)s);
             }
         }
         else
         {
             PassiveSkill passive = GetPassive(CachedTreeSkills[i].GetType());
             if (passive && PlayerData.SkillTreelvls[i] != 0)
             {
                 passive.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]);
             }
             else if (passive && PlayerData.SkillTreelvls[i] == 0)
             {
                 Passives.Remove(passive);
                 passive.Delete();
             }
             else if (passive == null && PlayerData.SkillTreelvls[i] != 0)
             {
                 Skill s = CachedTreeSkills[i].Instantiate();
                 s.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]);
                 Passives.Add((PassiveSkill)s);
             }
         }
     }
 }