Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
DnD/New Unity Project 1/Assets/Scripts/Generator.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
85 lines (70 sloc)
1.81 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.UI; | |
public class Generator : MonoBehaviour | |
{ | |
public float Str; | |
public float Dex; | |
public float Con; | |
public float Int; | |
public float Wis; | |
public float Chr; | |
public float HP; | |
public float EnemyHP; | |
public string StrString; | |
public string DexString; | |
public string ConString; | |
public string IntString; | |
public string WisString; | |
public string ChrString; | |
public string HPString; | |
public string EHPString; | |
public Text textStr; | |
public Text textDex; | |
public Text textCon; | |
public Text textInt; | |
public Text textWis; | |
public Text textChr; | |
public Text textHP; | |
public Text textEHP; | |
void Start () | |
{ | |
Str = 0; | |
Dex = 0; | |
Con = 0; | |
Int = 0; | |
Wis = 0; | |
Chr = 0; | |
EnemyHP = 10; | |
} | |
// Update is called once per frame | |
void Update () | |
{ | |
} | |
public void Click (string text) | |
{ | |
Str = (Random.Range(1, 6) + Random.Range (1,6) + Random.Range (1,6)); | |
Dex = (Random.Range(1, 6) + Random.Range (1,6) + Random.Range (1,6)); | |
Con = (Random.Range(1, 6) + Random.Range (1,6) + Random.Range (1,6)); | |
Int = (Random.Range(1, 6) + Random.Range (1,6) + Random.Range (1,6)); | |
Wis = (Random.Range(1, 6) + Random.Range (1,6) + Random.Range (1,6)); | |
Chr = (Random.Range(1, 6) + Random.Range (1,6) + Random.Range (1,6)); | |
HP = Mathf.Round ( ( Con * 0.10f ) + ( Random.Range (1, 8) ) ) ; | |
EHPString = EnemyHP.ToString (); | |
textEHP.text = EHPString; | |
StrString = Str.ToString(); | |
textStr.text = StrString; | |
DexString = Dex.ToString(); | |
textDex.text = DexString; | |
ConString = Con.ToString(); | |
textCon.text = ChrString; | |
IntString = Int.ToString(); | |
textInt.text = IntString; | |
WisString = Wis.ToString(); | |
textWis.text = WisString; | |
ChrString = Chr.ToString(); | |
textChr.text = ChrString; | |
HPString = HP.ToString(); | |
textHP.text = HPString; | |
} | |
} |