This commit is contained in:
allylikesfrogs
2023-05-03 08:15:59 -07:00
parent 3aa0823bbe
commit f1e2de295f
2 changed files with 43 additions and 15 deletions

View File

@@ -21,8 +21,8 @@ public class PlayerBehavior : MonoBehaviour
[Header("Clarinet:")]
bool unlockedClarinet;
[SerializeField] private float dashMult = 2;
[SerializeField] private float maxDashTime = 10.0f;
[SerializeField] private float dashStopSpeed = 0.1f;
[SerializeField] private float maxDashTime = 5.0f;
[SerializeField] private float dashStopSpeed = 0.01f;
private float currentDashTime;
public bool isDash = false;
@@ -101,22 +101,21 @@ public class PlayerBehavior : MonoBehaviour
{
isDash = true;
currentDashTime = 0.0f;
playerInput.DeactivateInput();
}
if (!playerController.IsGrounded())
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime))
{
Vector3 dashSpeed = new Vector3(1f,1f,1f) * dashMult;
if (currentDashTime < maxDashTime)
{
_rb.AddForce(dashSpeed, ForceMode2D.Force);
currentDashTime += dashStopSpeed;
print("cdt " + currentDashTime);
}
else
{
isDash = false;
}
_rb.AddForce(dashSpeed, ForceMode2D.Force);
currentDashTime += dashStopSpeed;
print("cdt " + currentDashTime);
}
else
{
isDash = false;
playerInput.ActivateInput();
}
else{isDash = false;}
}
}