public void SetResult(float previousCompletionLevel, ActiveSkillLevel activeSkillLevel)
 {
     this.activeSkillLevel        = activeSkillLevel;
     this.previousCompletionLevel = previousCompletionLevel;
     fillSlider.SetValues(0, previousCompletionLevel, Color.magenta);
     textmeshSkillName.text = activeSkillLevel.SkillLevel.Skill.Name;
 }
 public UnlockReturn HandleUnlock(BaseData newUnlock)
 {
     if (newUnlock is Skill)
     {
         Skill newSkill = newUnlock as Skill;
         ActiveSkillCategory activeSkillCategory = GetActiveSkillCategory(newSkill.SkillCategory);
         if (activeSkillCategory == null)
         {
             activeSkillCategory = new ActiveSkillCategory(newSkill.SkillCategory);
             ActiveSkillCategories.Add(activeSkillCategory);
         }
         ActiveSkill activeSkill = activeSkillCategory.GetActiveSkill(newSkill);
         if (activeSkill == null)
         {
             activeSkill = new ActiveSkill(newSkill);
             activeSkillCategory.ActiveSkills.Add(activeSkill);
             return(UnlockReturn.NewUnlock);
         }
         return(UnlockReturn.WasUnlocked);
     }
     if (newUnlock is SkillLevel)
     {
         SkillLevel          newSkillLevel       = newUnlock as SkillLevel;
         ActiveSkillCategory activeSkillCategory = GetActiveSkillCategory(newSkillLevel.Skill.SkillCategory);
         if (activeSkillCategory == null)
         {
             activeSkillCategory = new ActiveSkillCategory(newSkillLevel.Skill.SkillCategory);
             ActiveSkillCategories.Add(activeSkillCategory);
         }
         ActiveSkill activeSkill = activeSkillCategory.GetActiveSkill(newSkillLevel.Skill);
         if (activeSkill == null)
         {
             activeSkill = new ActiveSkill(newSkillLevel.Skill);
             activeSkillCategory.ActiveSkills.Add(activeSkill);
         }
         ActiveSkillLevel activeSkillLevel = activeSkill.GetActiveSkillLevel(newSkillLevel);
         if (activeSkillLevel == null)
         {
             activeSkillLevel = new ActiveSkillLevel(newSkillLevel);
             activeSkill.ActiveSkillLevels.Add(activeSkillLevel);
             return(UnlockReturn.NewUnlock);
         }
         return(UnlockReturn.WasUnlocked);
     }
     if (newUnlock is TrainingData)
     {
         TrainingData        newTraining         = newUnlock as TrainingData;
         ActiveSkillCategory activeSkillCategory = GetActiveSkillCategory(newTraining.TargetSkill.SkillCategory);
         if (activeSkillCategory == null)
         {
             activeSkillCategory = new ActiveSkillCategory(newTraining.TargetSkill.SkillCategory);
             ActiveSkillCategories.Add(activeSkillCategory);
         }
         ActiveSkill activeSkill = activeSkillCategory.GetActiveSkill(newTraining.TargetSkill);
         if (activeSkill == null)
         {
             activeSkill = new ActiveSkill(newTraining.TargetSkill);
             activeSkillCategory.ActiveSkills.Add(activeSkill);
         }
         ActiveTraining activeTraining = activeSkill.ActiveTraining;
         if (activeTraining == null)
         {
             activeTraining             = new ActiveTraining(newTraining);
             activeSkill.ActiveTraining = activeTraining;
             return(UnlockReturn.NewUnlock);
         }
         if (activeTraining.Data == null)
         {
             activeTraining.Data = newTraining;
             return(UnlockReturn.NewUnlock);
         }
         else
         {
             if (activeTraining.Training.XPGainTraining < newTraining.XPGainTraining)
             {
                 activeTraining.Data = newTraining;
                 return(UnlockReturn.NewUnlock);
             }
         }
         return(UnlockReturn.WasUnlocked);
     }
     throw new System.ArgumentException("Unlock not supported for " + newUnlock);
 }