Exemplo n.º 1
0
        /// /////////////////////////////////////////////////////////
        /// Methods
        /// /////////////////////////////////////////////////////////

        // Reinit demolished mesh object
        public static void ResetRigid(RayfireRigid scr)
        {
            // Object can't be reused
            if (ObjectReuseState(scr) == false)
            {
                return;
            }

            // Save faded/demolished state before reset
            int  faded      = scr.fading.state;
            bool demolished = scr.limitations.demolished;

            // Reset tm
            if (scr.reset.transform == true)
            {
                RestoreTransform(scr);
            }

            // Reset activation TODO check ifi t was Kinematik
            if (scr.activation.activated == true)
            {
                scr.simulationType = SimType.Inactive;
            }

            // Reset rigid props
            Reset(scr);

            // Stop all cors in case object restarted
            scr.StopAllCoroutines();

            // Reset if object fading/faded
            if (faded >= 1)
            {
                ResetFade(scr);
            }

            // Demolished. Restore
            if (demolished == true)
            {
                ResetMeshDemolition(scr);
            }

            // Restore cluster even if it was not demolished
            ResetClusterDemolition(scr);

            // Activate if deactivated
            if (scr.gameObject.activeSelf == false)
            {
                scr.gameObject.SetActive(true);
            }

            // Start all coroutines
            scr.StartAllCoroutines();
        }