My character creation order is: Select Race, Select Class, Assign Bonus Stat Points, Customize and Name the character.
Because I am using Unity's UI components I am using scripts attached to empty objects (eg. _RaceManager, _ClassManager) that handle which button is pressed and select the actual race or class.
However a look on the inspector shows stat values as 0. So I must be doing something wrong!
MY QUESTION: How would my Playing Character (Player) get the selected values depending on race and class?
Here is an example of my code (actual code is too big to post):
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class Class_GOnClick : MonoBehaviour {
public GameObject Barbarian, Knight, Paladin, Assassin, Scout, Shadow, Elementalist, Druid, Summoner, Priest, Hunter, Next, Previous, descRect, ClassPanel, RacePanel, RaceManager;
StageIDs sID = new StageIDs(); //0 - ERROR, 1 - RACE, 2 - CLASS, 3 - STATS, 4 - CUSTOMIZATION
public static BaseClass classSelection;
public void Start()
{
sID.id = 2;
Barbarian.GetComponent<Button>().onClick.AddListener(() => { isBarbarian(); });
Next.GetComponent<Button>().onClick.AddListener(() => { _Next(); });
Previous.GetComponent<Button>().onClick.AddListener(() => { _Previous(); });
descRect = GameObject.Find("DescriptionText");
descRect.GetComponent<Text>().text = "";
}
public void isBarbarian()
{
SaveInformation _Info = new SaveInformation();
classSelection = new BarbarianClass();
descRect.GetComponent<Text>().text = classSelection.CharacterClassDesc;
_Info.Constitution += classSelection.Constitution;
_Info.Strength += classSelection.Strength;
_Info.Intelligence += classSelection.Intelligence;
_Info.Dexterity += classSelection.Dexterity;
_Info.Charisma += classSelection.Charisma;
_Info.Wisdom += classSelection.Wisdom;
_Info.Willpower += classSelection.Willpower;
_Info.Luck += classSelection.Luck;
_Info.Perception += classSelection.Perception;
_Info.MaxPhResist += classSelection.MaxpResist;
_Info.MaxMaResist += classSelection.MaxmResist;
_Info.MaxSpeed += classSelection.MaxSpeed;
}
public void _Next()
{
//ClassPanel.SetActive(false);
}
public void _Previous()
{
ClassPanel.SetActive(false);
RacePanel.SetActive(true);
Previous.SetActive(false);
RaceManager.SetActive(true);
}
}
As requested, the Barbarian Class:
using UnityEngine;
using System.Collections;
public class BarbarianClass : BaseClass {
public BarbarianClass(){
//Description
CharacterClassName = "Barbarian";
CharacterClassDesc = "The Barbarian is a breed of Fighter focused more on damage than defense. Often characterized by wearing less armor, being less civilized, and being able to fly into a berserker rage that increases damage output or allow them to do more damage based on how hurt they are.";
CharacterClassOrigin = "Fighter";
//Base Stats
Constitution = 5;
Strength = 10;
Intelligence = 5;
Dexterity = 5;
Charisma = 3;
Wisdom = 3;
Willpower = 3;
Luck = 3;
Perception = 5;
//CurHp = ;
//MaxHp = ;
//CurpResist = MaxpResist;
MaxpResist = 5;
//CurmResist = MaxmResist;
MaxmResist = 1;
//CurSpeed = MaxSpeed;
MaxSpeed = 5;
}
}