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);
}
}