aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Assets/Scripts
diff options
context:
space:
mode:
authorCarson Katri <carson.katri@gmail.com>2021-06-13 09:15:00 -0400
committerCarson Katri <carson.katri@gmail.com>2021-06-13 09:15:00 -0400
commite484685210b4db2ee2ab21e0a71d0fe9043ae81d (patch)
tree3600db992d98dfbc516fd7a5f8783bc871f04438 /Assets/Scripts
parentc65c617e2031aa6ece4fa6831891fcf1e13662d4 (diff)
downloadgmtk-gamejam-e484685210b4db2ee2ab21e0a71d0fe9043ae81d.tar.gz
gmtk-gamejam-e484685210b4db2ee2ab21e0a71d0fe9043ae81d.tar.zst
gmtk-gamejam-e484685210b4db2ee2ab21e0a71d0fe9043ae81d.zip
Add shot indicator
Diffstat (limited to 'Assets/Scripts')
-rw-r--r--Assets/Scripts/Controllers/AIController.cs2
-rw-r--r--Assets/Scripts/Controllers/Player/PlayerController.cs12
2 files changed, 13 insertions, 1 deletions
diff --git a/Assets/Scripts/Controllers/AIController.cs b/Assets/Scripts/Controllers/AIController.cs
index 7246023..5a3761c 100644
--- a/Assets/Scripts/Controllers/AIController.cs
+++ b/Assets/Scripts/Controllers/AIController.cs
@@ -71,7 +71,7 @@ namespace Controllers
private static readonly int Running = Animator.StringToHash("Running");
private void FixedUpdate()
{
- Animator.SetBool(Running, (lastPosition - transform.position).x > 0.025);
+ Animator.SetBool(Running, (lastPosition - transform.position).x > 0.015);
lastPosition = transform.position;
}
diff --git a/Assets/Scripts/Controllers/Player/PlayerController.cs b/Assets/Scripts/Controllers/Player/PlayerController.cs
index 134abdc..e555bec 100644
--- a/Assets/Scripts/Controllers/Player/PlayerController.cs
+++ b/Assets/Scripts/Controllers/Player/PlayerController.cs
@@ -19,6 +19,9 @@ namespace Controllers.Player
[SerializeField] private float maxLegAngle;
[SerializeField] private float legSpeed;
+ [SerializeField] private GameObject progressBarContainer;
+ [SerializeField] private GameObject progressBar;
+
public PlayerSegment root => segments[0];
private float ShootStartTime;
@@ -102,10 +105,19 @@ namespace Controllers.Player
// 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);
if (Input.GetKeyUp(controls.shoot))
+ {
game.player.Shoot(segments.Last().transform, Time.time - ShootStartTime);
+ progressBarContainer.SetActive(false);
+ }
}
[Serializable]