trying dash things
This commit is contained in:
parent
fba3f60354
commit
7ab17418bb
@ -24,6 +24,8 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
[SerializeField] private float dashStopSpeed = 0.01f;
|
[SerializeField] private float dashStopSpeed = 0.01f;
|
||||||
private float currentDashTime;
|
private float currentDashTime;
|
||||||
public bool isDash = false;
|
public bool isDash = false;
|
||||||
|
public Vector2 moveDirection;
|
||||||
|
public float dashDistance = 5;
|
||||||
|
|
||||||
[Header("Grappling:")]
|
[Header("Grappling:")]
|
||||||
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
||||||
@ -104,17 +106,15 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime))
|
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime))
|
||||||
{
|
{
|
||||||
Vector2 dashSpeed;
|
|
||||||
if(forward == 1)
|
if(forward == 1)
|
||||||
{
|
{
|
||||||
dashSpeed = new Vector2(1,-1) * dashMult;
|
moveDirection = transform.right * dashDistance;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dashSpeed = new Vector2(-1,-1) * dashMult;
|
moveDirection = -(transform.right) * dashDistance;
|
||||||
}
|
}
|
||||||
|
//_rb.AddForce(dashSpeed, ForceMode2D.Force);
|
||||||
_rb.AddForce(dashSpeed, ForceMode2D.Force);
|
|
||||||
currentDashTime += dashStopSpeed;
|
currentDashTime += dashStopSpeed;
|
||||||
print("cdt " + currentDashTime);
|
print("cdt " + currentDashTime);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user