Example #1
0
    private void OnCollisionEnter(Collision collision)
    {
        healthBehaviour healthBehaviour = collision.gameObject.GetComponent <healthBehaviour>();

        if (healthBehaviour != null)
        {
            healthBehaviour.TakeDamage(20);
        }
        Destroy(gameObject, 1);
    }
Example #2
0
 private void Awake()
 {
     _healthBehaviour = this.gameObject.GetComponent <healthBehaviour>();
 }