IEnumerator TriggerExplosion(CorruptExplosion data) { data.sender.SetActive(false); yield return(new WaitForSeconds(data.delay)); data.sender.SetActive(true); if (data.shake) { CameraController.singleton.Shake(.1f, .15f); } for (int i = 0; i < data.rate; i++) { StartCoroutine(moveExplosionObj(data)); } }
IEnumerator moveExplosionObj(CorruptExplosion data) { GameObject obj = Instantiate(data.prefab, data.sender.transform.position, data.sender.transform.rotation); CorruptColour c = GameHandler.GetRandomCorruptColour(); obj.GetComponent <Corrupt>().corruptColour = c; //Debug.Log(c); float Rnd_R = UnityEngine.Random.Range(0f, 360); obj.transform.Rotate(new Vector3(0f, 0f, Rnd_R)); for (; ;) { yield return(null); if (PlayerUI.singleton.isPaused) { continue; } obj.transform.Translate(obj.transform.up * Time.fixedDeltaTime * data.speed * 0.1f); } }