void OnTriggerEnter2D(Collider2D coll) { if (coll.tag.Equals("PlayerAttack")) { healthCtrl.Damaged(50.0f); } else if (coll.tag.Equals("Buwaaang")) { healthCtrl.Damaged(100.0f); } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Enemy") { EnemyHealth enemyhp = other.GetComponent <EnemyHealth>(); enemyhp.Damaged(Dmg); Destroy(gameObject); } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Enemy") { transform.Find("Blood").gameObject.SetActive(true); transform.Find("Blood").parent = other.transform; EnemyHealth enemyhp = other.GetComponent <EnemyHealth>(); enemyhp.Damaged(Dmg); Destroy(gameObject); } }
private void OnTriggerEnter(Collider enemy) { if (enemy.gameObject.CompareTag("Enemy")) { transform.Find("Blood").gameObject.SetActive(true); transform.Find("Blood").parent = enemy.transform; EnemyHealth enemyhp = enemy.GetComponent <EnemyHealth>(); enemyhp.Damaged(Dmg); Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Enemy") { this.GetComponent <SpriteRenderer>().enabled = false; this.GetComponent <BoxCollider2D>().enabled = false; EnemyHealth enemy = collision.GetComponent <EnemyHealth>(); if (enemy != null) { enemy.Damaged(attackDamage); } Destroy(gameObject); } }