Assets/scripts/Character classes/BaseCharacter.cs(21,73): error CS0246: The type or namespace name `AttributeName' could not be found. Are you missing a using directive or an assembly reference?
Assets/scripts/Character classes/BaseCharacter.cs(21,56): error CS1502: The best overloaded method match for `System.Enum.GetValues(System.Type)' has some invalid arguments
Assets/scripts/Character classes/BaseCharacter.cs(21,56): error CS1503: Argument `#1' cannot convert `object' expression to type `System.Type'
I think by solving the first, the rest will fall into order. Here is my code:
BaseCharacter:
Code: Select all
using UnityEngine;
using System.Collections;
using System; //added to acces the enum class
public class BaseCharacter : MonoBehaviour {
private string _name;
private int _level;
private uint _freeExp;
private Attribute[] _primaryAttribute;
private Vital[] _vital;
private Skill[] _skill;
public void Awake() {
_name = string.Empty;
_level = 0;
_freeExp = 0;
_primaryAttribute = new Attribute[Enum.GetValues(typeof(AttributeName)).Length];
_vital = new Vital[Enum.GetValues(typeof(VitalName)).Length];
_skill = new Skill[Enum.GetValues(typeof(SkillName)).Length];
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public string Name {
get{return _name;}
set{_name = value;}
}
public int Level {
get{return _level;}
set{_level = value;}
}
public uint FreeExp {
get{return _freeExp;}
set{_freeExp = value;}
}
public void AddExp(uint exp){
_freeExp += exp;
}
private void SetupPrimaryAttributes(){
}
private void SetupVitals(){
}
private void SetupSkills(){
}
}
and Attribute
Code: Select all
public class Attribute : BaseStat {
public Attribute() {
exptolevel = 50;
LevelModifier = 2.05f;
}
public enum AttributeName {
might,
Constitution,
Nimbleness,
Speed,
Concentration,
Willpower,
Charisma
}
}