// Update is called once per frame void Update() { //dealing with too many collisions that the unattach script doesn't get turned off properly fixStealScript(); if (!GetComponent <Unattach_Bomb> ().isActiveAndEnabled) { currentBombTime += Time.deltaTime; } if (!GetComponent <Unattach_Bomb> ().isActiveAndEnabled&& (theGameTimer.returnGameTime() <= 0.0)) { gameObject.SetActive(false); // Disables game object and children recursively } if (theGameTimer.returnGameTime() < 0.0) { gameObject.GetComponent <Basic_Side_Movement>().enabled = false; } }
//if there is still time left in the countDown keep changing color //else destroy the bomb and everything it's touching (all its children) //change color to red when countDown is even, else change to white void blinkRed() { if (theGameTimer.returnGameTime() > 50.0f) { this.GetComponent <SpriteRenderer>().sprite = s1; } else if (theGameTimer.returnGameTime() > 40.0f) { this.GetComponent <SpriteRenderer>().sprite = s2; } else if (theGameTimer.returnGameTime() > 30.0f) { this.GetComponent <SpriteRenderer>().sprite = s3; } else if (theGameTimer.returnGameTime() > 20.0f) { this.GetComponent <SpriteRenderer>().sprite = s4; } else if (theGameTimer.returnGameTime() > 10.0f) { this.GetComponent <SpriteRenderer>().sprite = s5; } else if (theGameTimer.returnGameTime() > 0.1f) { this.GetComponent <SpriteRenderer>().sprite = s6; } else if (theGameTimer.returnGameTime() <= 0.0f) { spawnedObject = GameObject.Instantiate(explosion, transform.position, transform.rotation) as GameObject; Destroy(gameObject); } }