Hello, I am trying to u make my player dash using Unity’s new input System but I can’t find a way to do it
private void Awake()
{
controls = new PlayerControlls();
controls.GamePlay.Up.performed += dash => ???;
}
private void Update()
{
// Dash
if (??? && currentDash < 0)
{
anim.SetFloat("Velocity", 0);
currentDash = DashTime;
anim.SetBool("Dashing", true);
}
else if (currentDash >= 0)
{
anim.SetFloat("Velocity", 0);
//Dash Damage
Collider2D[] swing = Physics2D.OverlapCircleAll(attackPoint.position, AttackRange, enemyLayers);
foreach (Collider2D stab in swing)
{
if (!hitEnemies.Contains(stab))
{
hitEnemies.Add(stab);
if (stab.GetComponent<MaskedOrc>() != null)
stab.GetComponent<MaskedOrc>().TakeDamage(Damage);
}
}
currentDash -= Time.deltaTime;
}
else
{
hitEnemies.Clear();
anim.SetBool("Dashing", false);
rb.velocity = Vector2.zero;
}
}
private void FixedUpdate()
{
if (currentDash >= 0)
{
switch (dashDir)
{
case 1:
rb.velocity = new Vector2(-DashPower * Time.fixedDeltaTime, 0);
break;
case 2:
rb.velocity = new Vector2(DashPower * Time.fixedDeltaTime, 0);
break;
}
}
}