/// </summary>
[SerializeField] public Ball ball;
+ [SerializeField] public Hoop PlayerHoop;
+ [SerializeField] public Hoop EnemyHoop;
+
private void Awake()
{
player = new Player { isEnemy = false, controller = this };
/// </summary>
internal GameController controller;
+ internal int score;
+
+ private Vector2 lastShotPosition;
+ public void Score(Vector2 Rim) {
+ if (Vector2.Distance(lastShotPosition, Rim) >= 1)
+ {
+ score += 3;
+ Debug.Log("Three point");
+ } else
+ score += 2;
+ Debug.Log("Two point");
+ }
+
private State dribble => isEnemy ? State.EnemyDribble : State.PlayerDribble;
private State shoot => isEnemy ? State.EnemyShoot : State.PlayerShoot;
if (controller.state != dribble) return false; // We must be dribbling the ball to shoot it.
controller.state = shoot;
controller.ball.Shoot(playerTransform);
+ lastShotPosition = playerTransform.position;
return true;
}
}