diff options
Diffstat (limited to 'Assets/Scripts/Controllers/GameController.cs')
-rw-r--r-- | Assets/Scripts/Controllers/GameController.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Assets/Scripts/Controllers/GameController.cs b/Assets/Scripts/Controllers/GameController.cs index 646b750..1573405 100644 --- a/Assets/Scripts/Controllers/GameController.cs +++ b/Assets/Scripts/Controllers/GameController.cs @@ -60,6 +60,8 @@ namespace Controllers private State dribble => isEnemy ? State.EnemyDribble : State.PlayerDribble; private State shoot => isEnemy ? State.EnemyShoot : State.PlayerShoot; + private Hoop hoop => isEnemy ? controller.EnemyHoop : controller.PlayerHoop; + public bool HasBall => controller.state == dribble; /// <summary> @@ -80,7 +82,7 @@ namespace Controllers public bool GrabBall(Vector2 handPosition) { // Don't allow the ball to be picked up if someone shot it. Also don't try picking it up if we're already holding it. - //if (controller.state.IsShot() || controller.state == dribble) return false; + if (controller.state == shoot || controller.state == dribble) return false; // Make sure its within their grab area. if (Vector2.Distance(controller.ball.transform.position, handPosition) > 0.75f) return false; @@ -99,7 +101,7 @@ namespace Controllers { if (controller.state != dribble) return false; // We must be dribbling the ball to shoot it. controller.state = shoot; - controller.ball.Shoot(playerTransform); + controller.ball.Shoot(hoop.transform.position); lastShotPosition = playerTransform.position; return true; } |