private IEnumerator OnClick() { yield return(StartCoroutine(Panel.SelectSkill(Root.AllSkills .Select(v => v.Model <Skill>()) .Where(s => SkillRequarements.Check(s, Root.PlayerView.Model <Player>())) .Except(Root.PlayerView.Model <Player>().KnownSkills.Select(r => r.Skill))))); if (Panel.SelectedSkill != null) { Root.PlayerView.Model <Player>().LearnSkill(Panel.SelectedSkill.Model <Skill>()); } }
public bool LearnSkill(Skill skill) { if (SkillPoints <= 0) { return(false); } if (KnownSkills.Any(r => r.Skill == skill)) { return(false); } if (!SkillRequarements.Check(skill, this)) { return(false); } SkillPoints--; KnownSkills.Add(GetSkillReference(skill)); return(true); }