public long Explode()
        {
            int count = this.pool.Count;
            int index = 0;

            if (count == 0)
            {
                return(0);
            }
            this.watch.Start();
            if (this.parameters.Callback != null)
            {
                this.parameters.Callback(0.0f, ExploderObject.ExplosionState.ExplosionStarted);
            }
            Vector3    vector3    = Vector3.get_zero();
            Quaternion quaternion = Quaternion.get_identity();

            if (Object.op_Implicit((Object)this.originalObject))
            {
                vector3    = Vector3.op_Subtraction(this.originalObject.get_transform().get_position(), this.initPos);
                quaternion = Quaternion.op_Multiply(this.originalObject.get_transform().get_rotation(), Quaternion.Inverse(this.initRot));
            }
            while (index < count)
            {
                Fragment fragment = this.pool[index];
                ++index;
                if (Object.op_Inequality((Object)this.originalObject, (Object)this.parameters.ExploderGameObject))
                {
                    ExploderUtils.SetActiveRecursively(this.originalObject, false);
                }
                else
                {
                    ExploderUtils.EnableCollider(this.originalObject, false);
                    ExploderUtils.SetVisible(this.originalObject, false);
                }
                Transform transform1 = ((Component)fragment).get_transform();
                transform1.set_position(Vector3.op_Addition(transform1.get_position(), vector3));
                Transform transform2 = ((Component)fragment).get_transform();
                transform2.set_rotation(Quaternion.op_Multiply(transform2.get_rotation(), quaternion));
                fragment.Explode(this.parameters);
            }
            if (this.parameters.DestroyOriginalObject && Object.op_Implicit((Object)this.originalObject) && !Object.op_Implicit((Object)this.originalObject.GetComponent <Fragment>()))
            {
                Object.Destroy((Object)this.originalObject);
            }
            if (this.parameters.ExplodeSelf && !this.parameters.DestroyOriginalObject)
            {
                ExploderUtils.SetActiveRecursively(this.parameters.ExploderGameObject, false);
            }
            if (this.parameters.HideSelf)
            {
                ExploderUtils.SetActiveRecursively(this.parameters.ExploderGameObject, false);
            }
            this.watch.Stop();
            return(this.watch.ElapsedMilliseconds);
        }
        public override bool Run(float frameBudget)
        {
            int count = this.core.pool.Count;

            while (this.core.poolIdx < count)
            {
                Fragment   fragment = this.core.pool[this.core.poolIdx];
                MeshObject post     = this.core.postList[this.core.poolIdx];
                ++this.core.poolIdx;
                if (Object.op_Implicit((Object)post.original))
                {
                    Mesh unityMesh = post.mesh.ToUnityMesh();
                    fragment.AssignMesh(unityMesh);
                    if (Object.op_Implicit((Object)post.option) && Object.op_Implicit((Object)post.option.FragmentMaterial))
                    {
                        ((Renderer)fragment.meshRenderer).set_sharedMaterial(post.option.FragmentMaterial);
                    }
                    else if (Object.op_Inequality((Object)this.core.parameters.FragmentOptions.FragmentMaterial, (Object)null))
                    {
                        ((Renderer)fragment.meshRenderer).set_sharedMaterial(this.core.parameters.FragmentOptions.FragmentMaterial);
                    }
                    else
                    {
                        ((Renderer)fragment.meshRenderer).set_sharedMaterial(post.material);
                    }
                    unityMesh.RecalculateBounds();
                    Transform parent = ((Component)fragment).get_transform().get_parent();
                    ((Component)fragment).get_transform().set_parent(post.parent);
                    ((Component)fragment).get_transform().set_position(post.position);
                    ((Component)fragment).get_transform().set_rotation(post.rotation);
                    ((Component)fragment).get_transform().set_localScale(post.localScale);
                    ((Component)fragment).get_transform().set_parent((Transform)null);
                    ((Component)fragment).get_transform().set_parent(parent);
                    if (Object.op_Inequality((Object)post.original, (Object)this.core.parameters.ExploderGameObject))
                    {
                        ExploderUtils.SetActiveRecursively(post.original, false);
                    }
                    else
                    {
                        ExploderUtils.EnableCollider(post.original, false);
                        ExploderUtils.SetVisible(post.original, false);
                    }
                    if (Object.op_Implicit((Object)post.skinnedOriginal) && Object.op_Inequality((Object)post.skinnedOriginal, (Object)this.core.parameters.ExploderGameObject))
                    {
                        ExploderUtils.SetActiveRecursively(post.skinnedOriginal, false);
                    }
                    else
                    {
                        ExploderUtils.EnableCollider(post.skinnedOriginal, false);
                        ExploderUtils.SetVisible(post.skinnedOriginal, false);
                    }
                    if (Object.op_Implicit((Object)post.skinnedOriginal) && Object.op_Implicit((Object)post.bakeObject))
                    {
                        Object.Destroy((Object)post.bakeObject, 1f);
                    }
                    bool flag           = Object.op_Implicit((Object)post.option) && post.option.Plane2D;
                    bool use2Dcollision = this.core.parameters.Use2DCollision;
                    if (!this.core.parameters.FragmentOptions.DisableColliders)
                    {
                        if (this.core.parameters.FragmentOptions.MeshColliders && !use2Dcollision)
                        {
                            if (!flag)
                            {
                                fragment.meshCollider.set_sharedMesh(unityMesh);
                            }
                        }
                        else if (this.core.parameters.Use2DCollision)
                        {
                            MeshUtils.GeneratePolygonCollider(fragment.polygonCollider2D, unityMesh);
                        }
                        else
                        {
                            BoxCollider boxCollider1 = fragment.boxCollider;
                            Bounds      bounds1      = unityMesh.get_bounds();
                            Vector3     center       = ((Bounds) ref bounds1).get_center();
                            boxCollider1.set_center(center);
                            BoxCollider boxCollider2 = fragment.boxCollider;
                            Bounds      bounds2      = unityMesh.get_bounds();
                            Vector3     extents      = ((Bounds) ref bounds2).get_extents();
                            boxCollider2.set_size(extents);
                        }
                    }
                    fragment.Explode(this.core.parameters);
                    float force = this.core.parameters.Force;
                    if (Object.op_Implicit((Object)post.option) && post.option.UseLocalForce)
                    {
                        force = post.option.Force;
                    }
                    fragment.ApplyExplosion(post.transform, post.mesh.centroid, force, post.original, this.core.parameters);
                    if ((double)this.Watch.ElapsedMilliseconds > (double)frameBudget)
                    {
                        return(false);
                    }
                }
            }
            if (this.core.parameters.DestroyOriginalObject)
            {
                foreach (MeshObject post in this.core.postList)
                {
                    if (Object.op_Implicit((Object)post.original) && !Object.op_Implicit((Object)post.original.GetComponent <Fragment>()))
                    {
                        Object.Destroy((Object)post.original);
                    }
                    if (Object.op_Implicit((Object)post.skinnedOriginal))
                    {
                        Object.Destroy((Object)post.skinnedOriginal);
                    }
                }
            }
            if (this.core.parameters.ExplodeSelf && !this.core.parameters.DestroyOriginalObject)
            {
                ExploderUtils.SetActiveRecursively(this.core.parameters.ExploderGameObject, false);
            }
            if (this.core.parameters.HideSelf)
            {
                ExploderUtils.SetActiveRecursively(this.core.parameters.ExploderGameObject, false);
            }
            this.Watch.Stop();
            return(true);
        }