Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System;
- 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];
- SetupPrimaryAttributes();
- 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();
- }
- //Take Avg of all the players skills and assign that as the player level
- public void CalculateLevel()
- {
- }
- private void SetupPrimaryAttributes()
- {
- for(int cnt = 0; cnt < _primaryAttribute.Length; cnt++)
- {
- _primaryAttribute[cnt] = new Attribute();
- }
- }
- private void SetupVitals()
- {
- for(int cnt = 0; cnt < _vital.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.Health).AddModifier(new ModifyingAttribute(attribute = GetPrimaryAttribute((int)AttributeName.Constitution), .5f));
- // Energy
- GetVital ((int)VitalName.Energy).AddModifier(new ModifyingAttribute(attribute = GetPrimaryAttribute((int)AttributeName.Constitution), 1f));
- // Mana
- GetVital((int)VitalName.Mana).AddModifier(new ModifyingAttribute(attribute = GetPrimaryAttribute((int)AttributeName.WillPower), 1));
- }
- private void SetupSkillModifiers()
- {
- // Melee Offense
- GetSkill((int)SkillName.Melee_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Might), .33f));
- GetSkill((int)SkillName.Melee_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Nimbleness), .33f));
- // Melee Offense
- GetSkill((int)SkillName.Melee_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed), .33f));
- GetSkill((int)SkillName.Melee_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Constitution), .33f));
- // Magic Offense
- GetSkill((int)SkillName.Magic_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration), .33f));
- GetSkill((int)SkillName.Magic_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.WillPower), .33f));
- // Magic Defense
- GetSkill((int)SkillName.Magic_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration), .33f));
- GetSkill((int)SkillName.Magic_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.WillPower), .33f));
- // Ranged Offense
- GetSkill((int)SkillName.Ranged_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration), .33f));
- GetSkill((int)SkillName.Ranged_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed), .33f));
- //Ranged Defense
- GetSkill((int)SkillName.Ranged_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed), .33f));
- GetSkill((int)SkillName.Ranged_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Nimbleness), .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();
- }
- }
- }
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(123,85): error CS0103: The name `attribute' does not exist in the current context
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(123,155): error CS1502: The best overloaded method match for `ModifyingAttribute.ModifyingAttribute(Attribute, float)' has some invalid arguments
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(123,155): error CS1503: Argument `#1' cannot convert `object' expression to type `Attribute'
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(123,50): error CS1502: The best overloaded method match for `ModifiedStat.AddModifier(ModifyingAttribute)' has some invalid arguments
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(123,50): error CS1503: Argument `#1' cannot convert `object' expression to type `ModifyingAttribute'
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(125,85): error CS0103: The name `attribute' does not exist in the current context
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(125,154): error CS1502: The best overloaded method match for `ModifyingAttribute.ModifyingAttribute(Attribute, float)' has some invalid arguments
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(125,154): error CS1503: Argument `#1' cannot convert `object' expression to type `Attribute'
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(125,50): error CS1502: The best overloaded method match for `ModifiedStat.AddModifier(ModifyingAttribute)' has some invalid arguments
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(125,50): error CS1503: Argument `#1' cannot convert `object' expression to type `ModifyingAttribute'
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(127,82): error CS0103: The name `attribute' does not exist in the current context
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(127,147): error CS1502: The best overloaded method match for `ModifyingAttribute.ModifyingAttribute(Attribute, float)' has some invalid arguments
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(127,147): error CS1503: Argument `#1' cannot convert `object' expression to type `Attribute'
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(127,47): error CS1502: The best overloaded method match for `ModifiedStat.AddModifier(ModifyingAttribute)' has some invalid arguments
- Assets/Scripts/PlayerScripts/Character-Classes/BaseCharacter.cs(127,47): error CS1503: Argument `#1' cannot convert `object' expression to type `ModifyingAttribute'
Advertisement
Add Comment
Please, Sign In to add comment