You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
1.8 KiB
89 lines
1.8 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
public class Equipment : MonoBehaviour
|
|
{
|
|
public Text text1;
|
|
public Text text2;
|
|
public Text text3;
|
|
public Text text4;
|
|
public Text text5;
|
|
public int id;
|
|
public string name;
|
|
public string attribute1;
|
|
public string attribute2;
|
|
public float min1;
|
|
public float max1;
|
|
public float min2;
|
|
public float max2;
|
|
public float ChangeV1;
|
|
public float ChangeV2;
|
|
public string dm1;
|
|
public string dm2;
|
|
float time1;
|
|
float time2;
|
|
float curvalue1 = 0;
|
|
float curvalue2 = 0;
|
|
private void Start()
|
|
{
|
|
if (attribute1 != null)
|
|
{
|
|
curvalue1 = min1;
|
|
}
|
|
|
|
if (attribute2 != null)
|
|
{
|
|
curvalue2 = min2;
|
|
}
|
|
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (min1 != 0)
|
|
{
|
|
time1 += Time.deltaTime;
|
|
if (time1 >= ChangeV1)
|
|
{
|
|
time1 = 0;
|
|
curvalue1++;
|
|
if (curvalue1 >= max1)
|
|
{
|
|
curvalue1 = min1;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (min2 != 0)
|
|
{
|
|
time2 += Time.deltaTime;
|
|
if (time2 >= ChangeV2)
|
|
{
|
|
time2 = 0;
|
|
curvalue2++;
|
|
if (curvalue2 >= max2)
|
|
{
|
|
curvalue2 = min2;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
text1.text = name;
|
|
text2.text = attribute1;
|
|
text3.text = curvalue1.ToString()+dm1;
|
|
if (curvalue2 == 0)
|
|
{
|
|
text4.text = "";
|
|
text5.text = "";
|
|
}
|
|
else
|
|
{
|
|
text4.text = attribute2;
|
|
text5.text = curvalue2.ToString()+dm2;
|
|
}
|
|
|
|
}
|
|
}
|