//DESTROY DEKLARATION public void Destroy(bool _withAnimation, bool _deleteFromList, bool _applyPlayerGrow, bool _withSound) { if (!alreadyDestroyed) { alreadyDestroyed = true; //Delete that one Particle from the Particles-Array - somtimes they already have been removed if (_deleteFromList) { ParticleSpawnScript.instance.instantiatedParticles.Remove(this); } //Play Destroy-Animation and shake Screen, if animations are allowed if (_withAnimation) { ShakeScript.instance.Shake(); if (particleSys != null) { particleSys.Play(); } if (particleType == ParticleType.grow) { StartCoroutine(delayedVibration()); } } if (_withSound) { SoundScript.ExplosionSmall(); } //Let Player Grow if an "shrink"-Particle gets Detroyed if (_applyPlayerGrow && particleType == ParticleType.shrink) { PlayerScript.instance.SetTargetMass(PlayerScript.instance.targetMass += ConstantManager.PARTICLE_MASS_TO_ADD_ON_DESTROY_WRONG_PARTICLE); } //Hide Particle and Colliders, enabel Particle system and Destroy after Animation played meshRenderer.enabled = false; meshCollider.enabled = false; sphereCollider.enabled = false; GameObject.Destroy(this.gameObject, 1f); } }