Hello i need set Secconds to Hour production how? Or show only hour production no seconds
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class BananaHandler : MonoBehaviour {
public float totalBan;
public float bps;
public Text totalBanTxt;
public Text bpsTxt;
public ShopHandler shopHandler;
public Button buySomething;
public float updateTime;
float counter;
public bool minimumUpdateTime;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
BananasSecond ();
if (totalBan < 5)
buySomething.interactable = false;
else
buySomething.interactable = true;
if (minimumUpdateTime)
updateTime = Time.deltaTime;
bpsTxt.text= bps + " Kov za sekundu";
totalBanTxt.text= totalBan.ToString("F1") + " Kov";
if (counter < updateTime)
counter += Time.deltaTime;
else {
totalBan+= bps*updateTime;
counter=0;
}
}
public void moreBananas()
{
totalBan -= 5;
bps += 10;
}
public void BananasSecond()
{
bps = 0;
foreach (ShopHandler.Item item in shopHandler.shopItems) {
bps= bps + item.count*item.gain;
}
}
}
using UnityEngine;
using System.Collections;
public class ButtonsMaster : MonoBehaviour {
public Animator shopanim;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void shopcontrol()
{
if (shopanim.GetBool ("isUp"))
shopanim.SetBool ("isUp", false);
else
shopanim.SetBool ("isUp", true);
}
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ItemScript : MonoBehaviour {
public Image icon;
public Text name;
public Text cost;
public Text gain;
public Text count;
public Button thisButton;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
¨
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ShopHandler : MonoBehaviour {
public BananaHandler banHandler;
public GameObject button;
int counter;
[System.Serializable]
public class Item{
public string name;
public Sprite image;
public float cost;
public float gain;
public int count;
}
public GameObject[] buttonItems;
public Item[] shopItems;
// Use this for initialization
void Start () {
buttonItems= new GameObject[shopItems.Length];
counter = 0;
foreach (Item i in shopItems)
{
GameObject btn = (GameObject)Instantiate(button);
buttonItems[counter]=btn;
ItemScript scp = btn.GetComponent<ItemScript>();
scp.name.text=i.name;
scp.cost.text= "Cost: " + i.cost.ToString("F1");
scp.count.text= i.count.ToString();
scp.gain.text= "BPS: " + i.gain.ToString("F1");
scp.icon.sprite= i.image;
Item thisItem = i;
scp.thisButton.onClick.AddListener(() => Purchase(thisItem) );
btn.transform.SetParent(this.transform);
counter++;
}
}
void Purchase(Item bought)
{
bought.count++;
bought.cost = bought.cost * 1.2f;
bought.gain = bought.cost * 0.005f;
UpdateItems ();
}
void UpdateItems()
{
counter = 0;
foreach (Item i in shopItems)
{
ItemScript scp = buttonItems[counter].GetComponent<ItemScript>();
//btn.GetComponent<ItemScript>().name.text
scp.name.text=i.name;
scp.cost.text= "Cost: " + i.cost.ToString("F1");
scp.count.text= i.count.ToString();
scp.gain.text= "BPS: " + i.gain.ToString("F1");
scp.icon.sprite= i.image;
counter++;
}
}
// Update is called once per frame
void Update () {
counter = 0;
foreach (Item i in shopItems)
{
if(i.cost> banHandler.totalBan)
buttonItems[counter].GetComponent<Button>().interactable=false;
else
buttonItems[counter].GetComponent<Button>().interactable=true;
counter++;
}
}
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class TouchStuff : MonoBehaviour {
int i;
public int maxFinger;
int fingerCount;
public Text score;
bool screenPressed;
public GameObject cut;
Vector3 worldPos;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(screenPressed){
fingerCount = 0;
foreach (Touch touch in Input.touches) {
if (touch.phase == TouchPhase.Began && fingerCount<maxFinger)
{i++;
this.GetComponent<Animator>().SetBool("Tapped",true);
worldPos= Camera.main.ScreenToWorldPoint(touch.position);
worldPos.z=0;
Instantiate(cut,worldPos,Quaternion.Euler(0,0,Random.Range(80,100)));
}
fingerCount++;
screenPressed=false;
}
}
score.text = i.ToString ();
}
public void TappedFalse()
{
this.GetComponent<Animator>().SetBool("Tapped",false);
}
public void CheckFingers()
{
screenPressed = true;
}
}