6 [RequireComponent(typeof(AudioSource))]
7 public class Hoop : MonoBehaviour
9 internal GameController controller;
11 [SerializeField] private BoxCollider2D Rim;
12 [SerializeField] private BoxCollider2D Net;
13 [SerializeField] private AudioSource shotSound;
15 private void OnTriggerEnter2D(Collider2D other)
17 if (other.GetComponent<Ball>() == null) return;
19 if (Rim.IsTouching(other) && Net.IsTouching(other))
22 if (this == controller.PlayerHoop)
23 controller.player.Score(Rim.transform.position);
24 else if (this == controller.EnemyHoop)
25 controller.enemy.Score(Rim.transform.position);