public override void OnDeath(Death death) { var go = death.gameObject; death.DestroyOnDeath = false; go.GetComponent <Rigidbody2D>().velocity = Vector2.zero; var allComps = go.gameObject.GetComponentsInChildren <Behaviour>(); foreach (var comp in allComps) { var type = comp.GetType(); if (type == typeof(Transform) || type == typeof(Animator) || type == typeof(SortingGroup) || type == typeof(SpriteRenderer)) { continue; } comp.enabled = false; } go.GetComponentInChildren <Animator>().SetTrigger("death"); death.OnDeathAnimFinish += () => { death.StartCoroutine(DeathFade(go)); }; SoundManager.PlaySound(Sounds.EnemyFleshHitFatal); }