Skip to content
Permalink
116aaf71f5
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
91 lines (69 sloc) 1.8 KB
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Fight : MonoBehaviour
{
public float NHP;
public string NHPString;
public Text textNHP;
public float NEHP;
public string NEHPString;
public Text textNEHP;
public float EnemyMainDmg;
public string EnemyDamage;
public InputField Damage;
public Text textEnemyDamage;
public float EnemySecondDmg;
public string ESD;
public InputField ESecond;
public Text textESD;
public float PlayerDamage;
public string PDmg;
public InputField PDamage;
public Text textPDMG;
public float PSecondDmg;
public string PSecDmg;
public InputField PSDmg;
public Text textPSDmg;
public float EPM;
public string EPMString;
public InputField EPMInput;
public Text textEPM;
public float Test;
void Start ()
{
}
void Update ()
{
}
public void Clicking (string text)
{
GameObject Main_Camera = GameObject.Find ("Main_Camera");
Generator Generator = Main_Camera.GetComponent <Generator> ();
EPMString = textEPM.text.ToString ();
EPM = float.Parse (EPMString);
NHPString = NHP.ToString ();
textNHP.text = NHPString;
NEHPString = NEHP.ToString ();
textNEHP.text = NEHPString;
EnemyDamage = textEnemyDamage.text.ToString ();
EnemyMainDmg = float.Parse (EnemyDamage);
ESD = textESD.text.ToString ();
EnemySecondDmg = float.Parse (ESD);
PDmg = textPDMG.text.ToString ();
PlayerDamage = float.Parse (PDmg);
PSecDmg = textPSDmg.text.ToString ();
PSecondDmg = float.Parse (PSecDmg);
if (Random.Range (0, 100) > EPM)
{
NHP = (Generator.HP - Mathf.Round (Random.Range (EnemyMainDmg, EnemySecondDmg)));
Generator.HP = NHP;
}
else
{
print ("Enemy missed their attack");
}
NEHP = Generator.EnemyHP - (Mathf.Round (Random.Range (PlayerDamage, PSecondDmg)));
Generator.EnemyHP = NEHP;
}
}