aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCameron Katri <me@cameronkatri.com>2021-06-13 12:25:28 -0400
committerCameron Katri <me@cameronkatri.com>2021-06-13 12:25:28 -0400
commit1b91ab39bdde7cf2a2b68472ae30a76b48311aa5 (patch)
tree689cb0b25e7e01005ad6abddaf2befaaf6412e6b
parentce6e15a6488476e8e490cb4a43f4591c266835cb (diff)
downloadgmtk-gamejam-1b91ab39bdde7cf2a2b68472ae30a76b48311aa5.tar.gz
gmtk-gamejam-1b91ab39bdde7cf2a2b68472ae30a76b48311aa5.tar.zst
gmtk-gamejam-1b91ab39bdde7cf2a2b68472ae30a76b48311aa5.zip
Only shoot if you have the ball
-rw-r--r--Assets/Scripts/Controllers/Player/PlayerController.cs26
1 files changed, 14 insertions, 12 deletions
diff --git a/Assets/Scripts/Controllers/Player/PlayerController.cs b/Assets/Scripts/Controllers/Player/PlayerController.cs
index e555bec..191c970 100644
--- a/Assets/Scripts/Controllers/Player/PlayerController.cs
+++ b/Assets/Scripts/Controllers/Player/PlayerController.cs
@@ -103,20 +103,22 @@ namespace Controllers.Player
}
}
- // Try shooting the ball if pressed.
- if (Input.GetKeyDown(controls.shoot))
- {
- ShootStartTime = Time.time;
- progressBarContainer.SetActive(true);
- }
+ if (game.player.HasBall) {
+ // Try shooting the ball if pressed.
+ if (Input.GetKeyDown(controls.shoot))
+ {
+ ShootStartTime = Time.time;
+ progressBarContainer.SetActive(true);
+ }
- progressBar.transform.localScale = new Vector3(0.75f * Mathf.Clamp(Time.time - ShootStartTime, 0f, 1f), 0.05f, 1f);
- // progressBar.transform.localPosition = new Vector3(0.75f * (1 - Mathf.Clamp(Time.time - ShootStartTime, 0f, 1f)), 0f, 0f);
+ progressBar.transform.localScale = new Vector3(0.75f * Mathf.Clamp(Time.time - ShootStartTime, 0f, 1f), 0.05f, 1f);
+ // progressBar.transform.localPosition = new Vector3(0.75f * (1 - Mathf.Clamp(Time.time - ShootStartTime, 0f, 1f)), 0f, 0f);
- if (Input.GetKeyUp(controls.shoot))
- {
- game.player.Shoot(segments.Last().transform, Time.time - ShootStartTime);
- progressBarContainer.SetActive(false);
+ if (Input.GetKeyUp(controls.shoot))
+ {
+ game.player.Shoot(segments.Last().transform, Time.time - ShootStartTime);
+ progressBarContainer.SetActive(false);
+ }
}
}