Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class Brewery_Behavior : MonoBehaviour {
- public int GI = 0;
- public int beer = 0;
- float t = 0f;
- int m = 2;
- float tm = 15;
- int level = 1;
- int totalb = 0;
- int invested = 0;
- int cost;
- float y;
- int yint;
- public float eff = 1;
- //Bool?!
- bool auto = false;
- //UI
- public GameObject ui;
- bool s = false;
- //public GameObject stat
- public Status stat;
- public WorldStuff a;
- public Text yield;
- public Text invtxt;
- public Text tb;
- public Text efftxt;
- // Use this for initialization
- void Start () {
- ui.SetActive(s);
- }
- // Update is called once per frame
- void Update () {
- //Levels
- switch (level)
- {
- case 2:
- m = 4;
- cost = 8;
- tm = 8;
- stat.storage += 100;
- break;
- case 3:
- m = 6;
- cost = 5;
- tm = 4;
- stat.storage += 300;
- break;
- default:
- m = 2;
- cost = 3;
- tm = 12;
- stat.storage += 30;
- break;
- }
- //time
- t = (t + Time.deltaTime)*(0.25f/a.m);
- tm = tm / eff;
- if ((GI >= m)&&(t>=tm)&&!(beer/stat.storage == 1)) {
- beer = beer + (m/2);
- totalb++;
- GI = GI - m;
- t = 0;
- }
- //Stats
- y = ((a.m * 60) / tm);
- yield.text = "Beer per hour " + y.ToString("F1");
- invtxt.text = "Total invested " + invested.ToString();
- tb.text = "Total beer produced " + totalb.ToString();
- efftxt.text = "Efficency " + (eff * 100).ToString() + "%";
- //Automation
- if ((auto)&&(GI < 2))
- {
- Invest();
- }
- }
- public void Upgrade ()
- {
- level++;
- }
- void OnMouseOver()
- {
- if (Input.GetMouseButtonDown(0))
- {
- // Whatever you want it to do.
- ui.SetActive(s);
- s = !s;
- }
- }
- public void Invest ()
- {
- stat.money -= cost;
- invested += cost;
- GI++;
- }
- public void automate ()
- {
- auto = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement