Commit ff0e9958 by Philipp Adolf

Make dash cool down longer on collision

parent 290b428f
...@@ -21,6 +21,9 @@ public class PlayerControl : MonoBehaviour ...@@ -21,6 +21,9 @@ public class PlayerControl : MonoBehaviour
public float dashStartSpeed = 20.0f; public float dashStartSpeed = 20.0f;
public float dashEndSpeed = 8.0f; public float dashEndSpeed = 8.0f;
public float dashCoolDown = 0.5f; public float dashCoolDown = 0.5f;
public float dashCollisionCoolDown = 1.5f;
[HideInInspector]
public float currentDashCoolDown = 0.0f;
// public float jumpWaitTime = 2.0; // public float jumpWaitTime = 2.0;
[HideInInspector] [HideInInspector]
...@@ -77,7 +80,8 @@ public class PlayerControl : MonoBehaviour ...@@ -77,7 +80,8 @@ public class PlayerControl : MonoBehaviour
{ {
//TODO abfrage " is dashing" //TODO abfrage " is dashing"
body.AddForce(_controller.getDirectionOfMovement() * pushForce); body.AddForce(_controller.getDirectionOfMovement() * pushForce);
//TODO set is dashing to false lastDashStart = Time.time - dashCompletionTime;
currentDashCoolDown = dashCollisionCoolDown;
} }
} }
...@@ -102,6 +106,7 @@ public class PlayerControl : MonoBehaviour ...@@ -102,6 +106,7 @@ public class PlayerControl : MonoBehaviour
{ {
lastDashStart = Time.time; lastDashStart = Time.time;
currentDashDirection = dashDirection; currentDashDirection = dashDirection;
currentDashCoolDown = dashCoolDown;
} }
if (isDashing ()) if (isDashing ())
...@@ -179,7 +184,7 @@ public class PlayerControl : MonoBehaviour ...@@ -179,7 +184,7 @@ public class PlayerControl : MonoBehaviour
private bool canDash () private bool canDash ()
{ {
return getDashTime() >= dashCompletionTime + dashCoolDown; return getDashTime() >= dashCompletionTime + currentDashCoolDown;
} }
/*==========Power Ups // Bullet management ===*/ /*==========Power Ups // Bullet management ===*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment