Assets.Scripts.Player.PlayerHealth.OnDeath C# (CSharp) Method

OnDeath() public method

public OnDeath ( HitContext hitContext ) : void
hitContext Assets.Scripts.People.HitContext
return void
        public void OnDeath(HitContext hitContext)
        {
            var rigidBody = GetComponent<Rigidbody>();
            rigidBody.constraints = RigidbodyConstraints.None;
            rigidBody.AddExplosionForce(hitContext.Force * 2, transform.position - hitContext.Direction, 1f, 3f, ForceMode.Impulse);

            gameObject.GetComponent<BoxCollider>().center = Vector3.zero;
            gameObject.GetComponent<BoxCollider>().size = new Vector3(.4f,.3f, .27f);

            Destroy(GetComponent<CapsuleCollider>());
            Destroy(GetComponentInChildren<MouseRotationX>());
            Destroy(GetComponentInChildren<MouseRotationY>());
            Destroy(GetComponentInChildren<KeyboardMovement>());
            Destroy(GetComponentInChildren<Bobber>());
            Destroy(GetComponentInChildren<Tilter>());
            Destroy(GetComponentInChildren<PlayerInteractions>());
            Destroy(gameObject.GetComponent<PlayerGun>());
            Destroy(Hand);
        }
    }