Exemplo n.º 1
0
 public ExploderParams(ExploderObject exploder)
 {
     Position                    = ExploderUtils.GetCentroid(exploder.gameObject);
     DontUseTag                  = exploder.DontUseTag;
     Radius                      = exploder.Radius;
     UseCubeRadius               = exploder.UseCubeRadius;
     CubeRadius                  = exploder.CubeRadius;
     ForceVector                 = exploder.ForceVector;
     UseForceVector              = exploder.UseForceVector;
     Force                       = exploder.Force;
     FrameBudget                 = exploder.FrameBudget;
     TargetFragments             = exploder.TargetFragments;
     DeactivateOptions           = exploder.DeactivateOptions;
     DeactivateTimeout           = exploder.DeactivateTimeout;
     MeshColliders               = exploder.MeshColliders;
     ExplodeSelf                 = exploder.ExplodeSelf;
     HideSelf                    = exploder.HideSelf;
     ThreadOptions               = exploder.ThreadOption;
     DestroyOriginalObject       = exploder.DestroyOriginalObject;
     ExplodeFragments            = exploder.ExplodeFragments;
     SplitMeshIslands            = exploder.SplitMeshIslands;
     FragmentOptions             = exploder.FragmentOptions.Clone();
     SFXOptions                  = exploder.SFXOptions.Clone();
     Use2DCollision              = exploder.Use2DCollision;
     FragmentPoolSize            = exploder.FragmentPoolSize;
     FragmentPrefab              = exploder.FragmentPrefab;
     FadeoutOptions              = exploder.FadeoutOptions;
     DisableRadiusScan           = exploder.DisableRadiusScan;
     UniformFragmentDistribution = exploder.UniformFragmentDistribution;
     DisableTriangulation        = exploder.DisableTriangulation;
     ExploderGameObject          = exploder.gameObject;
 }
 public ExploderSettings(ExploderObject exploder)
 {
     Position = ExploderUtils.GetCentroid(exploder.gameObject);
     DontUseTag = exploder.DontUseTag;
     Radius = exploder.Radius;
     UseCubeRadius = exploder.UseCubeRadius;
     CubeRadius = exploder.CubeRadius;
     ForceVector = exploder.ForceVector;
     UseForceVector = exploder.UseForceVector;
     Force = exploder.Force;
     FrameBudget = exploder.FrameBudget;
     TargetFragments = exploder.TargetFragments;
     DeactivateOptions = exploder.DeactivateOptions;
     DeactivateTimeout = exploder.DeactivateTimeout;
     MeshColliders = exploder.MeshColliders;
     ExplodeSelf = exploder.ExplodeSelf;
     HideSelf = exploder.HideSelf;
     DestroyOriginalObject = exploder.DestroyOriginalObject;
     ExplodeFragments = exploder.ExplodeFragments;
     SplitMeshIslands = exploder.SplitMeshIslands;
     FragmentOptions = exploder.FragmentOptions.Clone();
     SfxOptions = exploder.SFXOptions.Clone();
     Use2DCollision = exploder.Use2DCollision;
     FragmentPoolSize = exploder.FragmentPoolSize;
     FragmentPrefab = exploder.FragmentPrefab;
     FadeoutOptions = exploder.FadeoutOptions;
     SFXOptions = exploder.SFXOptions;
     DisableRadiusScan = exploder.DisableRadiusScan;
     UniformFragmentDistribution = exploder.UniformFragmentDistribution;
     AllowOpenMeshCutting = exploder.AllowOpenMeshCutting;
 }
Exemplo n.º 3
0
        public void SetSFX(ExploderObject.SFXOption sfx, bool allowParticle)
        {
            audioClip = sfx.FragmentSoundClip;

            if (audioClip && !audioSource)
            {
                audioSource = gameObject.AddComponent <AudioSource>();
            }

            if (sfx.FragmentEmitter && allowParticle)
            {
                if (!particleChild)
                {
                    var dup = Instantiate(sfx.FragmentEmitter) as GameObject;

                    if (dup)
                    {
                        particleChild = new GameObject("Particles");
                        particleChild.transform.parent = gameObject.transform;

                        dup.transform.parent = particleChild.transform;

                        emmiters = dup.GetComponentsInChildren <ParticleEmitter>();
                    }
                }
            }
            else
            {
                if (particleChild)
                {
                    Destroy(particleChild);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// set options for fragment sound and particle effects
        /// </summary>
        /// <param name="sfx"></param>
        public void SetSFXOptions(ExploderObject.SFXOption sfx)
        {
            if (pool != null)
            {
                HitSoundTimeout = sfx.HitSoundTimeout;
                MaxEmitters     = sfx.EmitersMax;

                for (int i = 0; i < pool.Length; i++)
                {
                    pool[i].SetSFX(sfx, i < MaxEmitters);
                }
            }
        }
Exemplo n.º 5
0
        public void SetSFX(ExploderObject.SFXOption sfx, bool allowParticle)
        {
            audioClip = sfx.FragmentSoundClip;

            if (audioClip && !audioSource)
            {
                audioSource = gameObject.AddComponent <AudioSource>();
            }

            if (sfx.FragmentEmitter && allowParticle)
            {
                if (!particleChild)
                {
                    var dup = Instantiate(sfx.FragmentEmitter) as GameObject;

                    if (dup)
                    {
                        dup.transform.position         = Vector3.zero;
                        particleChild                  = new GameObject("Particles");
                        particleChild.transform.parent = gameObject.transform;

                        dup.transform.parent = particleChild.transform;
                    }
                }

                if (particleChild)
                {
                    particleSystems = particleChild.GetComponentsInChildren <ParticleSystem>();
                }

                emmitersTimeout   = sfx.ParticleTimeout;
                stopEmitOnTimeout = emmitersTimeout > 0.0f;
            }
            else
            {
                if (particleChild)
                {
                    Destroy(particleChild);
                    emmitersTimeout   = -1.0f;
                    stopEmitOnTimeout = false;
                }
            }
        }