private void Die() { isDead = true; animator.SetBool("DeathTrigger", true); transform.SetParent(game.allEntities); //Disable all behaviors try { this.GetComponent <Collider>().enabled = false; this.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.Discrete; this.GetComponent <Rigidbody>().isKinematic = true; }catch { } if (isPlayer) { game.GameEnded(); } else { Destroy(this.gameObject, despawn); //despawn try { game.AIGotKilled(killScore); GetComponent <AIController>().DropWeapon(); }catch {} } }