コード例 #1
0
        // Return type is bool so I can set a appropriate message in Tempdata
        public bool UpgradeSkill(int skillId, int playerId)
        {
            Player player = _iplayerContext.GetPlayerWithId(playerId);

            if (player.SkillPoints > 0 &&
                _iplayerContext.GetPlayerSkillWithId(skillId, playerId).SkillPoints < _iplayerContext.GetPlayerSkillWithId(skillId, playerId).MaxSkillPoints)
            {
                _iplayerContext.UpdatePlayerSkill(skillId, playerId);
                _iplayerContext.LowerPlayerSkillPoints(playerId);
                return(true);
            }
            return(false);
        }