// Update is called once per frame void Update() { if (myGameController.getCurScene() == GameController.GameScene.PlantLand) { fillImage.fillAmount = myOxygenController.getCurOxygen() / myOxygenController.getMaxOxygen(); } }
// Start is called before the first frame update void Start() { myGameController = GameObject.FindWithTag("GameController").GetComponent <GameController>(); myOxygenController = GameObject.FindWithTag("GameController").transform.parent.Find("OxygenController").GetComponent <OxygenController>(); fillImage = transform.GetChild(0).GetComponent <Image>(); fillImage.fillAmount = myOxygenController.getCurOxygen() / myOxygenController.getMaxOxygen(); }