aboutsummaryrefslogtreecommitdiffstats
path: root/Assets/Scripts/Actors
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Actors')
-rw-r--r--Assets/Scripts/Actors/Actor.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Assets/Scripts/Actors/Actor.cs b/Assets/Scripts/Actors/Actor.cs
index 3acd51c..96c67c2 100644
--- a/Assets/Scripts/Actors/Actor.cs
+++ b/Assets/Scripts/Actors/Actor.cs
@@ -17,6 +17,7 @@ namespace MontanaJohns.Actors
[SerializeField] protected Transform groundCheckPoint1;
[SerializeField] protected Transform groundCheckPoint2;
[SerializeField] protected float invulnTime = 0f;
+ [SerializeField] protected float hangTime;
protected Rigidbody2D _rigidBody;
protected SpriteRenderer _renderer;
@@ -30,11 +31,12 @@ namespace MontanaJohns.Actors
protected Collection<Item> items;
protected int jumpCount;
protected Vector2 acceleration;
+ protected bool invuln;
+ protected float hangCount;
public Stats stats;
public int health;
- private bool invuln;
protected virtual void Awake()
{
@@ -104,8 +106,13 @@ namespace MontanaJohns.Actors
if(Physics2D.OverlapCircle(groundCheckPoint1.position, 0.2f, groundLayers) || Physics2D.OverlapCircle(groundCheckPoint2.position, 0.2f, groundLayers))
{
jumpCount = stats.maxJumps;
+ hangCount = hangTime;
}
- if (jumpCount > 0)
+ else
+ {
+ hangCount -= Time.deltaTime;
+ }
+ if (jumpCount > 0 && hangCount > 0f)
{
jumpCount--;
_rigidBody.AddForce(Vector2.up * stats.jumpForce);