public void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { player.Take_Damage(damage, transform.position); } }
public void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.CompareTag("Player")) { player.Take_Damage(100, transform.position); } if (collision.transform.CompareTag("bullet")) { Take_damage(damage); } }
public void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.CompareTag("Player")) { player.Take_Damage(damage, transform.position); Destroy(this.gameObject); } if (collision.transform.CompareTag("Enemy") || collision.transform.CompareTag("Wall")) { Destroy(this.gameObject); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.CompareTag("bullet")) { if (state.ToString() == collision.gameObject.GetComponent <player_bullet>().state.ToString()) // 충돌한 총알의 색과 몬스터의 색상이 일치하는지 판단 { Take_damage(DataController.instance.gameData.Damage); } } if (collision.transform.CompareTag("Player")) { player.Take_Damage(damage, transform.position); } }