Hello there again unity
ive been writing a script during to today and when i thougt i was finnished a bunch of errors came up and i cant seem to fix them. starting to get very late and im starting to get very tierd maybe thats the reson, but if someone could take a look and help me up a bit i would apriicite it,
here is the code
using UnityEngine;
using System.Collections;
using System; // används för att kunna anänva 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];
SetupPrimaryAttrubutes();
SetupVitals ();
SetupSkills ();
}
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;
CalculateLevel ();
}
public void CalculateLevel () {
}
private void SetupPrimaryAttrubutes() {
for(int cnt = 0; cnt < _primaryAttribute.Length; cnt++) {
_primaryAttribute[cnt] = new Attribute();
}
}
private void SetupVitals () {
for(int cnt = 0; cnt < _vital.Length; cnt++) {
_primaryAttribute[cnt] = new Attribute();
}
}
private void SetupSkills () {
for(int cnt = 0; cnt < _skill.Length; cnt++) {
_primaryAttribute[cnt] = new Attribute();
}
}
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.Health).AddModifier (new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Stamina), .5f));
//energy
GetVital((int)VitalName.Energy).AddModifier (new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.energy), .1f));
//mana
GetVital((int)VitalName.Mana).AddModifier (new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.mana), .1f));
}
private void SetupSkillModifiers() {
//melee
Getskill((int)SkillName.Melee).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Strenght), .33f));
//ranged
Getskill((int)SkillName.Ranged).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.energy), .33f));
//magic
Getskill((int)SkillName.Magic).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.mana), .33f));
//defensive
Getskill((int)SkillName.defensive).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Stamina), .33f));
//heal
Getskill((int)SkillName.heal).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.mana), .33f));
}
public void StatUpdate () {
for(int cnt = 0; cnt < _vital.Length; cnt ++)
_vital[cnt].Update();
for (int cnt =0; cnt < _skill.Lenght; cnt++)
_skill[cnt].Update();
}
}
i can add the errors aswell if needed but probably you guys that have more experiance than me can just look at the code and know where i did wrong just tell me if you need the errors thanks!