This commit is contained in:
allylikesfrogs
2023-05-03 00:35:59 -07:00
parent ed72a093fb
commit 3aa0823bbe
2 changed files with 25 additions and 11 deletions

View File

@@ -21,9 +21,10 @@ public class PlayerBehavior : MonoBehaviour
[Header("Clarinet:")]
bool unlockedClarinet;
[SerializeField] private float dashMult = 2;
[SerializeField] private float maxDashTime = 1.0f;
[SerializeField] private float maxDashTime = 10.0f;
[SerializeField] private float dashStopSpeed = 0.1f;
private float currentDashTime;
public bool isDash = false;
[Header("Grappling:")]
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
@@ -98,19 +99,24 @@ public class PlayerBehavior : MonoBehaviour
{
if (playerInput.actions["ClarinetDive"].WasPressedThisFrame())
{
isDash = true;
currentDashTime = 0.0f;
}
if (!playerController.IsGrounded())
{
Vector3 dashSpeed = new Vector3(1f,1f,1f) * dashMult;
if (currentDashTime < maxDashTime)
{
Vector2 dashSpeed = new Vector2(1f,1f) * dashMult;
if (currentDashTime < maxDashTime)
{
_rb.AddForce(dashSpeed, ForceMode2D.Force);
currentDashTime += dashStopSpeed;
print("cdt " + currentDashTime);
}
// print("Clarinet pressed!");
_rb.AddForce(dashSpeed, ForceMode2D.Force);
currentDashTime += dashStopSpeed;
print("cdt " + currentDashTime);
}
else
{
isDash = false;
}
}
else{isDash = false;}
}
}