Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine.UI;
- using UnityEngine;
- public class GameController : MonoBehaviour
- {
- public double money;
- public double dpc;
- public double health;
- public double healthCap
- {
- get
- {
- return 10 * System.Math.Pow(2, stage - 1) * isBoss;
- }
- }
- public double reward;
- public int kills;
- public int stage;
- public int stageMax;
- public int killsMax;
- public int isBoss;
- public int timer;
- public int timerCap;
- public Text moneyText;
- public Text dPCText;
- public Text stageText;
- public Text killsText;
- public Text healthText;
- public GameObject back;
- public GameObject forward;
- public Image healthBar;
- public void Start()
- {
- stage = 1;
- stageMax = 1;
- killsMax = 10;
- kills = 0;
- healthCap = 10;
- health = healthCap;
- isBoss = 1;
- }
- public void Update()
- {
- moneyText.text = "$" + money.ToString("F2");
- stageText.text = "Stage - " + stage;
- killsText.text = kills + "/" + killsMax + " Kills";
- healthText.text = health + "/" + healthCap + " HP";
- dPCText.text = dpc + " dpc";
- healthBar.fillAmount = (float)(health / healthCap);
- if (stage > 1) back.gameObject.SetActive(true);
- else
- back.gameObject.SetActive(false);
- if (stage != stageMax) forward.gameObject.SetActive(true);
- else
- forward.gameObject.SetActive(false);
- IsBossChecker();
- }
- public void IsBossChecker()
- {
- if (stage % 5 == 0)
- {
- isBoss = 10;
- stageText.text = "(Boss!) Stage - " + stage;
- }
- else
- {
- isBoss = 1;
- }
- }
- public void Hit()
- {
- health -= dpc;
- if (health <= 0)
- {
- money += System.Math.Ceiling(healthCap / 14);
- if (stage == stageMax)
- {
- kills += 1;
- if (kills >= killsMax)
- {
- kills = 0;
- stage += 1;
- stageMax += 1;
- }
- }
- IsBossChecker();
- health = healthCap;
- }
- }
- public void Back()
- {
- if (stage > 1) stage -= 1;
- }
- public void Forward()
- {
- if (stage != stageMax) stage += 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement