Пример #1
0
        // Destroy particles
        static void DestroyParticles(RayfireRigid scr)
        {
            // Destroy debris
            if (scr.HasDebris == true)
            {
                for (int d = 0; d < scr.debrisList.Count; d++)
                {
                    if (scr.debrisList[d].hostTm != null)
                    {
                        scr.debrisList[d].hostTm.gameObject.SetActive(false);
                        RayfireMan.DestroyGo(scr.debrisList[d].hostTm.gameObject);
                    }
                }
            }

            // Destroy debris
            if (scr.HasDust == true)
            {
                for (int d = 0; d < scr.dustList.Count; d++)
                {
                    if (scr.dustList[d].hostTm != null)
                    {
                        scr.dustList[d].hostTm.gameObject.SetActive(false);
                        RayfireMan.DestroyGo(scr.dustList[d].hostTm.gameObject);
                    }
                }
            }
        }
Пример #2
0
        // Destroy fragments and root
        static void DestroyFragments(RayfireRigid scr)
        {
            // Destroy fragments
            if (scr.HasFragments == true)
            {
                // Get amount of fragments
                int fragmentNum = scr.fragments.Count(t => t != null);

                // Destroy fragments and root
                for (int i = scr.fragments.Count - 1; i >= 0; i--)
                {
                    if (scr.fragments[i] != null)
                    {
                        // Destroy fragment
                        RayfireMan.DestroyGo(scr.fragments[i].gameObject);

                        // Destroy root
                        if (scr.fragments[i].rootParent != null)
                        {
                            RayfireMan.DestroyGo(scr.fragments[i].rootParent.gameObject);
                        }
                    }
                }

                // Nullify
                scr.fragments = null;

                // Subtract amount of deleted fragments
                RayfireMan.inst.advancedDemolitionProperties.currentAmount -= fragmentNum;

                // Destroy descendants
                if (scr.limitations.descendants.Count > 0)
                {
                    // Get amount of descendants
                    int descendantNum = scr.limitations.descendants.Count(t => t != null);

                    // Destroy fragments and root
                    for (int i = 0; i < scr.limitations.descendants.Count; i++)
                    {
                        if (scr.limitations.descendants[i] != null)
                        {
                            // Destroy fragment
                            RayfireMan.DestroyGo(scr.limitations.descendants[i].gameObject);

                            // Destroy root
                            if (scr.limitations.descendants[i].rootParent != null)
                            {
                                RayfireMan.DestroyGo(scr.limitations.descendants[i].rootParent.gameObject);
                            }
                        }
                    }

                    // Clear
                    scr.limitations.descendants = new List <RayfireRigid>();

                    // Subtract amount of deleted fragments
                    RayfireMan.inst.advancedDemolitionProperties.currentAmount -= descendantNum;
                }
            }
        }