示例#1
0
    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>());
        }
    }
示例#2
0
文件: Player.cs 项目: gormel/has
        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);
        }