我有一个枚举列表
public enum SkillName {
Mele_Offence,
Mele_Defence
}
然后我的技能在Player class
上设置和修改private void SetupSkillModifires () {
// mele Offence
GetSkill((int)SkillName.Mele_Offence).AddModifire(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Strength), 2));
GetSkill((int)SkillName.Mele_Offence).AddModifire(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Agility), 1));
//mele Deffence
GetSkill((int)SkillName.Mele_Defence).AddModifire(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Agility), 1));
GetSkill((int)SkillName.Mele_Defence).AddModifire(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Vitality), 2));
//Magic Offence
}
然后我将它转换为字符串并在场景中显示。
private void DisplayAttributes() {
for(int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++) {
GUI.Label (new Rect (130, 60 + (cnt * 20), 100, 20), ((AttributeName)cnt).ToString());
GUI.Label (new Rect (300, 60 + (cnt * 20), 30, 25), _toon.GetPrimaryAttribute(cnt).AdjustedBaseValue.ToString());
if (GUI.Button (new Rect (265, 60 + (cnt * 20), 20, 20), "-")) {
if (_toon.GetPrimaryAttribute(cnt).BaseValue > MIN_STARTING_ATTRIBUTE_VALUE) {
_toon.GetPrimaryAttribute (cnt).BaseValue--;
pointsLeft++;
_toon.StatUpdate ();
}
如何将theese技能分配给玩家攻击值?
我有这个错误。
错误CS0029:无法将类型Skil
隐式转换为int
?