- Home /
Why do I keep getting this error?
I keep getting this error and I can't find the problem I don't know if I worded something wrong or I am missing a typo, but I can't get it to go away no matter what I do
Assets/chcarcterClasses/BaseCharacter.cs(101,64): error CS0246: The type or namespace name `ModifyingAttribute' could not be found. Are you missing a using directive or an assembly reference?
using UnityEngine; using System.Collections; using System; //acces the enum class
public class BaseCharacter : MonoBehaviour {
private string _name;
private int _level;
private uint _freeEx;
private Attribute[]_primaryAttribute;
private vital[]_vital;
private skill[]_skill;
public void Awake(){
_name = string.Empty;
_level =0;
_freeEx =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];
SetUpPrimaryAttribute();
SetUpVital();
SetUpSkills();
}
// 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 FreeEx{
get{ return _freeEx;}
set{ _freeEx = value;}
}
public void AddEx(uint ex){
_freeEx += ex;
CalculateLevel();
}
//take advantage of the players skills and assign them to a level
public void CalculateLevel(){
}
private void SetUpPrimaryAttribute(){
for(int cnt = 0; cnt < _primaryAttribute.Length; cnt++){
_primaryAttribute[cnt] = new Attribute();
}
}
private void SetUpVital(){
for( int cnt = 0; cnt <_skill.Length; cnt++){
_vital[cnt]= new vital();
}
}
private void SetUpSkills(){
for(int cnt = 0; cnt < _skill.Length; cnt++){
_skill[cnt] = new skill();
}
}
public Attribute GetPrimaryAttribute(int index){
return _primaryAttribute[index];
}
public vital GetVital(int index){
return _vital[index];
}
public skill GetSkill(int index){
return _skill[index];
}
private void SetUpVitalModifiers(){
//Health
GetVital((int)VitalName.Healh).AddModifier(new ModifyingAttribute()(GetPrimaryAttribute((int)AttributeName.Constitution), .5f));
//energy
GetVital((int)VitalName.Energy).AddModifier(new ModifyingAttribute()(GetPrimaryAttribute((int)AttributeName.Constitution), 1));
// mana
GetVital((int)VitalName.Mana).AddModifier(new ModifyingAttribute()(GetPrimaryAttribute((int)AttributeName.Willpower),1));
}
private void SetUpSkillModifiers()
{
//melee offence
GetSkill((int)SkillName.Magic_Offence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Might),.33f));
GetSkill((int)SkillName.Magic_Offence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.NImbelness),.33f));
//melee defence
GetSkill((int)SkillName.Melee_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed),.33f));
GetSkill((int)SkillName.Magic_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Constitution),.33f));
//magic offence
GetSkill((int)SkillName.Magic_Offence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Constitution),.33f));
GetSkill((int)SkillName.Magic_Offence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Willpower),.33f));
//magic defence
GetSkill((int)SkillName.Magic_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration),.33f));
GetSkill((int)SkillName.Magic_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration),.33f));
//ranged offence
GetSkill((int)SkillName.Ranged_Offence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration),.33f));
GetSkill((int)SkillName.Ranged_Offence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed),.33f));
//ranged defence
GetSkill((int)SkillName.Ranged_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed),.33f));
}
public void StatUpdate(){
for(int cnt =0; cnt <_vital.Length; cnt++)
_vital[cnt].Update();
for(int cnt = 0; cnt < _skill.Length; cnt++)
_skill[cnt].Update();
}
}
Please format your code. If you don't know how, watch the tutorial video on the right
I was following a tutorial and that was the script that I ended up with..... I don't understand why its a problem... Unless they made changes in the scripting language from unity 3 to unity 4
Please post comments as comments NOT as answers
Please follow as instructed and format your code. I can probably answer your question, but until you format your code I'm just not going to read it
Your answer
Follow this Question
Related Questions
Do you need Unity Pro to sell to the asset store or am I just glitching? 0 Answers
Redirect Unity unmanaged console 0 Answers
'Red' Errors in Console and Production of Garbage in Memory. 0 Answers
get component screws with the game. 2 Answers
The console no longer takes you directly to the error in the script? 1 Answer