//Dash
if (dashTime == -1)
{
if (playercoin.points >= 1 && Input.GetKeyDown("space"))
{
if (z == 1 && x == 0)
{
rb.velocity = Vector3.forward * dashSpeed;
dashTime = startdashTime;
playercoin.points--;
dashp.enableEmission = true;
dashp.Play();
Ability.fillAmount = 0;
}
if (z == -1 && x == 0)
{
rb.velocity = Vector3.back * dashSpeed;
dashTime = startdashTime;
playercoin.points--;
dashp.enableEmission = true;
dashp.Play();
Ability.fillAmount = 0;
}
if (z == 0 && x == -1)
{
rb.velocity = Vector3.left * dashSpeed;
dashTime = startdashTime;
playercoin.points--;
dashp.enableEmission = true;
dashp.Play();
Ability.fillAmount = 0;
}
if (z == 0 && x == 1)
{
rb.velocity = Vector3.right * dashSpeed;
dashTime = startdashTime;
playercoin.points--;
dashp.enableEmission = true;
dashp.Play();
Ability.fillAmount = 0;
}
}
}
else
{
rb.velocity = Vector2.zero;
dashTime -= Time.deltaTime;
Ability.fillAmount -= 1 / startdashTime * Time.deltaTime;
}
}