diff options
Diffstat (limited to 'Assets')
-rw-r--r-- | Assets/Scripts/Controllers/GameController.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Assets/Scripts/Controllers/GameController.cs b/Assets/Scripts/Controllers/GameController.cs index de3b00c..e1af95c 100644 --- a/Assets/Scripts/Controllers/GameController.cs +++ b/Assets/Scripts/Controllers/GameController.cs @@ -9,6 +9,7 @@ namespace Controllers public class GameController : MonoBehaviour { private State state = State.JumpBall; // A basketball game always starts with a jump ball. + internal Animator BallAnimation; public Player player; public Player enemy; @@ -30,6 +31,7 @@ namespace Controllers ball.controller = this; PlayerHoop.controller = this; EnemyHoop.controller = this; + BallAnimation = ball.GetComponentInChildren<Animator>(); } public struct Player @@ -90,6 +92,7 @@ namespace Controllers if (Vector2.Distance(controller.ball.transform.position, handPosition) >= 1f) return false; controller.state = dribble; + controller.BallAnimation.enabled = false; controller.dribbleSound.Play(); Move(handPosition); return true; @@ -103,6 +106,7 @@ namespace Controllers public bool Shoot(Transform playerTransform) { if (controller.state != dribble) return false; // We must be dribbling the ball to shoot it. + controller.BallAnimation.enabled = true; controller.dribbleSound.Stop(); controller.state = shoot; controller.ball.Shoot(hoop.transform.position); @@ -113,6 +117,7 @@ namespace Controllers internal void BallDropped() { + BallAnimation.enabled = true; dribbleSound.Stop(); state = State.Idle; } |