private void OnCollisionEnter2D(Collision2D collision) { if (!IsDashing()) { return; } if (collision.collider.CompareTag("Obstacle")) { audioSC.PlayOneShot(collideSFX); BeginStun(); } if (collision.collider.CompareTag("WaiterCollider")) { Waiter waiter = collision.collider.gameObject.transform.parent.gameObject.GetComponent <Waiter>(); if (waiter) { if (waiter.current_stun_time > 0 || current_stun_time > 0) { return; } if (IsDashing() && waiter.IsDashing()) { waiter.BeginStun(); BeginStun(); Debug.Log("Stun together"); } else if (IsDashing()) { waiter.BeginStun(); Debug.Log("Stun him"); } else if (waiter.IsDashing()) { BeginStun(); Debug.Log("Stun me"); } } } }