private void explode() { // Blow up comet Exploder2DUtils.SetActive(exploder.gameObject, true); exploder.transform.position = Exploder2DUtils.GetCentroid(gameObject); GameObject.FindGameObjectWithTag(Constants.EXPLOSION_PLAYER).GetComponent <AudioSource>().Play(); exploder.Explode(); Invoke("destroy", DESTROY_DELAY); }
private void explode() { Exploder2DUtils.SetActive(exploder.gameObject, true); exploder.Radius = 0.1f; exploder.Force = 1.0f; exploder.TargetFragments = 50; exploder.transform.position = Exploder2DUtils.GetCentroid(gameObject); exploder.Explode(); }
private void OnTriggerEnter2D(Collider2D other) { if (!other.CompareTag("Player")) { return; } FindObjectOfType <CameraController>().StopFollowingPlayer(); other.gameObject.tag = Constants.EXPLODER_2D; Exploder2DUtils.SetActive(exploder.gameObject, true); exploder.transform.position = Exploder2DUtils.GetCentroid(other.gameObject); exploder.Radius = 1.0f; exploder.Force = 5.0f; exploder.TargetFragments = 50; exploder.Explode(); GetComponent <AudioSource>().Play(); Invoke("fadeOut", FADE_DELAY); }
void ExplodeObject(GameObject obj) { // activate exploder Exploder2DUtils.SetActive(exploder.gameObject, true); // move exploder object to the same position exploder.transform.position = Exploder2DUtils.GetCentroid(obj); // decrease the radius so the exploder is not interfering other objects exploder.Radius = 0.1f; // DONE! #if ENABLE_CRACK_AND_EXPLODE exploder.Crack(OnCracked); #else exploder.Explode(OnExplosion); #endif }
private void startBlackHole() { if (sunExploded) { return; } FindObjectOfType <LevelManager>().PlayEvilBGM(); sun.tag = Constants.EXPLODER_2D; Exploder2DUtils.SetActive(sun, true); exploder.transform.position = Exploder2DUtils.GetCentroid(sun); exploder.Radius = 100.0f; exploder.Force = 32.0f; exploder.TargetFragments = 420; sunExploded = true; exploder.Explode(); blackHoleIsActive = true; blackHole.SetActive(true); }