void ExplodeObject(GameObject obj) { // activate exploder ExploderUtils.SetActive(Exploder.gameObject, true); // move exploder object to the same position Exploder.transform.position = ExploderUtils.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 }
/// <summary> /// call this to crack your object /// </summary> void CrackAndExplodeObject(GameObject obj) { Exploder.Crack(OnCracked); }