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?
Intro_Scritping/DnD Project/Assets/RNG_HP.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
68 lines (51 sloc)
1.4 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 RNG_HP : MonoBehaviour { | |
//HP Base Values | |
public int HPValue = 0; | |
public int HPValue1 = 0; | |
public int HPValue2 = 0; | |
public int HPValue3 = 0; | |
private string HPString; | |
public int conHpMod = 0; | |
//Con base Values | |
public int ConValue = 0; | |
public int ConValue1 = 0; | |
public int ConValue2 = 0; | |
public int ConValue3 = 0; | |
public int conPercent = 0; | |
private string ConString; | |
Text updates; | |
void Awake() | |
{ | |
updates = GetComponent<Text>(); | |
HPString = "HP:"; | |
} | |
// Use this for initialization | |
public void Roll() | |
{ | |
//HP Rolls | |
HPValue1 = Random.Range(1, 8); | |
HPValue2 = Random.Range(1, 8); | |
HPValue3 = Random.Range(1, 8); | |
HPValue = HPValue1 + HPValue2 + HPValue3 + conHpMod; | |
//Constituion Rolls | |
ConValue1 = Random.Range(1, 6); | |
ConValue2 = Random.Range(1, 6); | |
ConValue3 = Random.Range(1, 6); | |
ConValue = ConValue1 + ConValue2 + ConValue3; | |
//String Value | |
HPString = HPValue.ToString(); | |
ConString = ConValue.ToString(); | |
//ConHPModifiers | |
conHpMod = ConValue / 10; | |
Debug.Log(HPString); | |
Debug.Log(ConValue); | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
updates.text = "HP: " + HPString; | |
} | |
} |