// Update is called once per frame void Update() { if (ship == null) { Destroy(this.gameObject); return; } NuggetHandler nh = ship.GetComponent <NuggetHandler> (); if (nh == null) { droplet.SetActive(false); return; } if (nh.nuggets <= 0 || nh.nuggets >= nh.NuggetsToWin) { droplet.SetActive(false); } else { droplet.SetActive(true); } }
// Use this for initialization void Start() { timeToExtract = extractTime; pl1 = GameObject.FindGameObjectWithTag("Pl1"); pl2 = GameObject.FindGameObjectWithTag("Pl2"); pl1Nugs = pl1.GetComponentInChildren <NuggetHandler> (); pl2Nugs = pl2.GetComponentInChildren <NuggetHandler> (); nugs = GetComponent <NuggetHandler> (); zone = GetComponent <BoxCollider2D> (); }
// Use this for initialization void Start() { nuggetController = GameObject.FindGameObjectWithTag("the-ship").GetComponent <NuggetHandler>(); bar = gameObject.GetComponent <Image>(); }