}
}
- // 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);
+ }
}
}