private void OnCollisionEnter(Collision collision) { healthBehaviour healthBehaviour = collision.gameObject.GetComponent <healthBehaviour>(); if (healthBehaviour != null) { healthBehaviour.TakeDamage(20); } Destroy(gameObject, 1); }
private void Awake() { _healthBehaviour = this.gameObject.GetComponent <healthBehaviour>(); }