Making a game in Unity 5 and I have the Main-Menu, and CharacterCreation-Menu. However in the CharacterCreation-Menu I want it to display the “Warrior” stats and “Mage” stats once I click that class in the menu. How can I do so?
I realize that I can add more Menus with each class stats placed onto the screen with the UI text but that wouldn’t be that very fun, also that I can add a new canvas for each player on the CharacterCreationg_Menu but that would make Everything so hard to see and very messy.
I have a hunch that I should add the necessery information in the “public void Warrior” and “public void Mage” But I cannot figure it out.
Once I press a class in the CharacterCreation_Script:
CharacterCreation-Menu_Script:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class CharacterCreationScript : MonoBehaviour {
// Class Info
public Canvas classInfo;
// Class Buttons
public Button warrior;
public Button mage;
// Buttons
public Button createCharacter;
public Button goBack;
// Use this for initialization
void Start ()
{
classInfo = classInfo.GetComponent();
classInfo.enabled = false;
// Classes
warrior = warrior.GetComponent();
mage = mage.GetComponent();
// Buttons
createCharacter = createCharacter.GetComponent();
goBack = goBack.GetComponent();
}
// Classes
// Warrior
public void Warrior()
{
classInfo.enabled = true;
}
// Mage
public void Mage()
{
classInfo.enabled = true;
}
// Create Character Button
public void CreateCharacter()
{
Application.LoadLevel(“NewGame”);
}
// Go Back Button
public void GoBack()
{
Application.LoadLevel(“MainMenu”);
}
// Update is called once per frame
void Update ()
{
}
}
I get a text popping up on the screen “Class Info”
But it does not contain the information stored in the Player_Classes:
Warrior
using UnityEngine;
using System.Collections;
public class BaseWarriorClass : BaseCharacterClass
{
public BaseWarriorClass()
{
// Basic
CharacterClassName = “Warrior”;
CharacterClassDescription = “Uses melee to crush enemies.”;
//Gold = 100;
// Stats
Health = 100;
Mana = 100;
Stamina = 10;
Strength = 20;
Intelligence = 5;
Armour = 0;
Resistance = 0;
}
}
Mage
using UnityEngine;
using System.Collections;
public class BaseMageClass : BaseCharacterClass
{
public BaseMageClass()
{
// Basic
CharacterClassName = “Mage”;
CharacterClassDescription = “Uses spells to vaporize enemies.”;
//Gold = 100;
// Stats
Health = 100;
Mana = 100;
Stamina = 10;
Strength = 5;
Intelligence = 20;
Armour = 0;
Resistance = 0;
}
}