Example #1
0
        private void DestroyAtDeath()
        {
            if (_animationController != null)
            {
                _animationController.FadeOutAfterDeath();
            }

            // disable components
            if (_collider2D != null)
            {
                _collider2D.enabled = false;
            }

            float timeUntilDestroy = TIME_UNTIL_DESTRUCTION;             // deathtime

            // expand time if there is a possibility of gun launch
            //			if (weapon != null && weapon.type == WeaponType.Artillery && (weapon.rangeDelay * 1.1f > timeUntilDestroy))
            //			{
            //				timeUntilDestroy = weapon.rangeDelay * 1.1f;
            //			}

            if (_isInactiveInObjectPool)
            {
                StartCoroutine(WaitAndDisable(timeUntilDestroy));
            }
            else
            {
                Destroy(gameObject, timeUntilDestroy);
            }
        }