IEnumerator Exp() { bombsList = FindObjectsOfType <FallDown>(); for (int i = bombsList.Length - 1; i > -1; i--) { bombsList[i].gameObject.SetActive(false); GameObject newExplosion = explosion.GetClone(); newExplosion.transform.position = bombsList[i].gameObject.transform.position; newExplosion.SetActive(true); soundExplod.Play(); yield return(new WaitForSeconds(.2f)); } }
IEnumerator Spawn() { while (!Player.lose) { float ran2 = Random.Range(1, 102); if (ran2 < 100 && ran2 > 95) { randomStuff = life; } else if (ran2 > 100) { randomStuff = time; } else { randomStuff = bomb; } if (interval > .1) { interval -= .003f; } GameObject newStuff = randomStuff.GetClone(); newStuff.transform.position = new Vector2(Random.Range(-2.5f, 2.5f), 5.9f); newStuff.transform.rotation = Quaternion.identity; newStuff.SetActive(true); yield return(new WaitForSeconds(interval)); } }
public void Shoote() { GameObject newRocket = rocket.GetClone(); newRocket.transform.position = pointShoot.position; newRocket.transform.rotation = Quaternion.Euler(0, 0, 0); newRocket.SetActive(true); }
IEnumerator LoseExplode() { RocketMove.startShoot = false; GameObject newTheExplode = theExplode.GetClone(); newTheExplode.transform.position = RocketMove.temp; newTheExplode.SetActive(true); explosions.Add(GameObject.FindGameObjectWithTag("Explosion")); for (int i = 0; i < explosions.Count; i++) { if (explosions[i].activeInHierarchy) { soundExplod.Play(); yield return(new WaitForSeconds(.05f)); explosions[i].SetActive(false); } } }