Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using System.Timers;
- public class Boty : MonoBehaviour
- {
- GameControl gc;
- public static int zysk;
- public GameObject BuyButton;
- public float Koszt;
- public int iloscBotow=0;
- public int maxilosc;
- public int wartosc;
- public Text KosztText;
- public Text iloscBotowText;
- public Button buy;
- public Button collect;
- private static Timer timer;
- public int co_ile;
- // Use this for initialization
- void Start()
- {
- timer = new System.Timers.Timer();
- timer.Interval = co_ile * 1000;
- timer.AutoReset = true;
- timer.Enabled = true;
- zysk = wartosc;
- }
- void Update()
- {
- if (Koszt < 1000)
- { KosztText.text = "cost " + Koszt; }
- if(Koszt >=1000 & Koszt < 1000000)
- { KosztText.text = "cost " + Koszt / 1000 + " K"; }
- if(Koszt >=1000000)
- { KosztText.text = "cost" + Koszt / 1000000 + " KK"; }
- iloscBotowText.text = "Amount " + iloscBotow;
- }
- public void BuyBot()
- {
- if(GameControl.AbleToBuy(Koszt))
- {
- GameControl.dodajPW(-Koszt);
- iloscBotow = iloscBotow + 1;
- if (iloscBotow == maxilosc) { BuyButton.SetActive(false); }
- Koszt = Mathf.Round(Koszt*1.22f);
- timer.Elapsed += new ElapsedEventHandler(ZwiekszPunktyWiedzy);
- timer.Start();
- }
- }
- private static void ZwiekszPunktyWiedzy(object sender, System.Timers.ElapsedEventArgs e) { GameControl.PunktyWiedzy += zysk; }
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////
- using System.Collections;
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class GameControl : MonoBehaviour {
- public Button ksiazkaButton;
- public GameObject BotyPanel;
- public GameObject UpgradePanel;
- public GameObject AchievementPanel;
- public Text PunktyWiedzyText;
- public Text iloscKlikniecText;
- public static float PunktyWiedzy;
- public int iloscKlikniec;
- // Use this for initialization
- void Start() {
- UpgradePanel.SetActive(false);
- BotyPanel.SetActive(false);
- AchievementPanel.SetActive(false);
- }
- // Update is called once per frame
- void Update() {
- PunktyWiedzyText.text = "Points of Knowledge: " + PunktyWiedzy;
- iloscKlikniecText.text = "Click Amount: " + iloscKlikniec;
- }
- public void PunktyWiedzyZwieksz()
- {
- PunktyWiedzy += 1;
- }
- public void inciloscKlikniec()
- {
- iloscKlikniec += 1;
- }
- public void showBoty()
- {
- AchievementPanel.SetActive(false);
- BotyPanel.SetActive(true);
- UpgradePanel.SetActive(false);
- }
- public void hideBoty()
- {
- BotyPanel.SetActive(false);
- }
- public void showUpgrady()
- {
- AchievementPanel.SetActive(false);
- UpgradePanel.SetActive(true);
- BotyPanel.SetActive(false);
- }
- public void hideUpgrady()
- {
- UpgradePanel.SetActive(false);
- }
- public void showAchievementy()
- {
- AchievementPanel.SetActive(true);
- BotyPanel.SetActive(false);
- UpgradePanel.SetActive(false);
- }
- public void hideAchievementy()
- {
- AchievementPanel.SetActive(false);
- }
- public static void dodajPW(float increment)
- {
- PunktyWiedzy += increment;
- }
- public static bool AbleToBuy(float liczba)
- {
- if (liczba <= PunktyWiedzy)
- return true;
- else
- return false;
- }
- //public static void CoCzas(int wartosc, int ilosc) { PunktyWiedzy += wartosc*ilosc; }
- //public static void SetPunktyWiedzy(float PN)
- // {
- // this.PunktyWiedzy = PN;
- // }
- // public float GetPunktyWiedzy() { return PunktyWiedzy; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement