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 Animator HoopAnimator;
19 HoopAnimator = GetComponentInChildren<Animator>();
22 private void OnTriggerEnter2D(Collider2D other)
24 if (other.GetComponent<Ball>() == null) return;
26 if (Rim.IsTouching(other) && Net.IsTouching(other))
28 HoopAnimator.Rebind();
30 if (this == controller.PlayerHoop)
31 controller.player.Score(Rim.transform.position);
32 else if (this == controller.EnemyHoop)
33 controller.enemy.Score(Rim.transform.position);