private void OnCollisionEnter2D(Collision2D other) { Vector2 boxCenter = (Vector2)transform.position + 0.5f * (characterSize.y + boxSize.y) * Vector2.down; if (Physics2D.OverlapBox(boxCenter, boxSize, 0f, targetMask)) { Debug.Log("yes"); var collision = other; dd.DamageDealing(collision); } }
private void OnCollisionEnter2D(Collision2D other) { dd.DamageDealing(other); Instantiate(light, other.GetContact(0).point, Quaternion.Euler(0, 0, 0)); if (isNotPlaying) { isNotPlaying = false; ss.MakeSound(); //if(other.gameObject.layer == mask) } }