// Use this for initialization void Start() { BobCat = Daddy.GetComponent <BalloonController>(); active = BobCat.getShield(); if (!active) { MyShield.SetActive(false); } }
// Update is called once per frame void Update() { active = true; if (active) { if (!BobCat.getShield()) { active = false; MyShield.SetActive(false); } } }
public void BuyShield(Text text) { BalloonController bg = UIController.instance.player.GetComponent <BalloonController>(); if (bg.hasShield) { Debug.Log("You already have a f*****g shield"); } else if (UIController.instance.GetCoins() >= 5 || IamTesting) { UIController.instance.SpendCoins(5); bg.setShield(true); Debug.Log("Shield is here? " + bg.hasShield + " " + bg.getShield()); text.text = "BOUGHT!"; //Disable the button Button button = text.GetComponentInChildren <Button>(); button.GetComponent <Button>().interactable = false; } GotMoney(); }
/*Player has died*/ public void GameOver(string deathReason) { if (dead) { return; } BalloonController bs = player.GetComponent <BalloonController>(); if (bs.getShield()) { Debug.Log("Shield saved you"); bs.setShield(false); bs.SafeTime = 4; return; } dead = true; _coins += _tempCoins; _gameOverScript.GameOver(deathReason); save(); runs++; }