Hi :D! well this is not an error, I just want to know something....
I have been following the Hack 'n Slash tutorials I'm currently in the Character Creation step In video 23, In this step we create the Character creation Label where you set your Character's Name and distribute you points blah,blah whatever XD I want to Display my Defense and Attack Skills in two different columns, One with all the defense Skills and another with all the Attack ones...Something like this :
Skills:
Offense Defense Melee Offense 0 Melee Defense 0 Ranged Offense 0 Ranged Defense 0 Magic Offense 0 Magic Defense 0 Mental Offense 0 Mental Defense 0
This is my Character Generator Script:
using UnityEngine;
using System.Collections;
using System;
public class CharacterGenerator : MonoBehaviour {
private PlayerCharacter _toon;
// Use this for initialization
void Start () {
_toon = new PlayerCharacter();
_toon.Awake();
}
// Update is called once per frame
void Update () {
}
void OnGUI() {
DisplayName();
DisplayStatics();
DisplayVitals();
DisplaySkills();
}
private void DisplayName() {
GUI.Label(new Rect(10, 10, 50, 20), "Name:");
_toon.Name = GUI.TextArea(new Rect(65, 10, 100, 25), _toon.Name);
}
private void DisplayStatics()
{
for (int count = 0; count < Enum.GetValues(typeof(AttrbutionsName)).Length; count++)
{
GUI.Label(new Rect(10, 50 + (count * 25), 100, 25), ((AttrbutionsName)count).ToString());
GUI.Label(new Rect(115, 50 + (count * 25), 30, 25), _toon.GetPrimaryAttribute(count).AdjustedBaseValue.ToString());
}
}
private void DisplayVitals()
{
for (int count = 0; count < Enum.GetValues(typeof(VitalName)).Length; count++)
{
GUI.Label(new Rect(10, 260 + (count * 25), 100, 25), ((VitalName)count).ToString());
GUI.Label(new Rect(115, 260 + (count * 25), 30, 25), _toon.GetVital(count).AdjustedBaseValue.ToString());
}
}
private void DisplaySkills()
{
for (int count = 0; count < Enum.GetValues(typeof(SkillsNames)).Length; count++)
{
GUI.Label(new Rect(250, 50 + (count * 25), 200, 25), ((SkillsNames)count).ToString());
GUI.Label(new Rect(365, 50 + (count * 25), 30, 25), _toon.GetSkill(count).AdjustedBaseValue.ToString());
}
}
}
And This is my Skills Script:
public class Skill : ModifiedStat {
private bool _known;
public Skill()
{
_known = false;
ExpTopLevel = 25;
LevelModifier = 1.1f;
}
public bool Known {
get{return _known;}
set { _known = value; }
}
}
public enum SkillsNames
{
//Melee Skills
Melee_Offense,
Melee_Defense,
//Range Skills
Ranged_Offense,
Ranged_defense,
//Magic Skills
Magic_Offense,
Magic_Defense,
//Mental Skills
Mental_Offense,
Mental_Defense
}
My Scripts Are a little personalized so they aren't totally the same than the ones in the tutorial ;D
Well now here it comes my idea of how to do it....All the Offense Skills are Odd Numbers, and all the Defense Skills are Even Numbers, So I want two functions like this one:
private void DisplaySkills() {
for (int count = 0; count < Enum.GetValues(typeof(SkillsNames)).Length; count++)
{
GUI.Label(new Rect(250, 50 + (count * 25), 200, 25), ((SkillsNames)count).ToString());
GUI.Label(new Rect(365, 50 + (count * 25), 30, 25), _toon.GetSkill(count).AdjustedBaseValue.ToString());
}
}
But I need one that only gets the Odd numbers of the Enumeration,and another that only gets the Even numbers of the Enumeration...Is That Possible? Can you Help me? Can this be solved? Will you answer my questions?....Lets figure it out in the next Answer XD