private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Enemy") { Enemy enemy = collision.gameObject.GetComponent <Enemy>(); enemy.GetDamage(damage); } if (collision.gameObject.tag == "Boss") { Boss boss = collision.gameObject.GetComponent <Boss>(); boss.GetDamage(damage, "gun"); } if (collision.gameObject.tag == "Player") { if (collision.GetType().ToString() == "UnityEngine.CircleCollider2D") { PlayerZero zero = collision.gameObject.GetComponent <PlayerZero>(); zero.GetDamage(damage); Destroy(gameObject); } } else { Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player" && other.GetType().ToString() == "UnityEngine.CircleCollider2D") { PlayerZero zero = other.gameObject.GetComponent <PlayerZero>(); zero.GetDamage(damage); Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { if (collision.GetType().ToString() == "UnityEngine.CircleCollider2D") { PlayerZero zero = collision.gameObject.GetComponent <PlayerZero>(); zero.GetDamage(damage); } } }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { GameObject zero = other.gameObject; if (zero != null) { PlayerZero playerZero = zero.GetComponent <PlayerZero>(); playerZero.GetDamage(1000); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == target) { if (collision.gameObject.tag == "Player") { PlayerZero zero = collision.gameObject.GetComponent <PlayerZero>(); zero.GetDamage(damage); } if (collision.gameObject.tag == "Enemy") { Enemy enemy = collision.gameObject.GetComponent <Enemy>(); enemy.GetDamage(damage); } Destroy(gameObject); } }