update dash implementation
This commit is contained in:
parent
368fbcb634
commit
ce71c20acb
@ -32038,13 +32038,17 @@ PrefabInstance:
|
||||
propertyPath: m_RootOrder
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8574288191223281125, guid: b7611ec9c156a6d40ae4a76a0def99dd, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 3.9620514
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8574288191223281125, guid: b7611ec9c156a6d40ae4a76a0def99dd, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -22.510845
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8574288191223281125, guid: b7611ec9c156a6d40ae4a76a0def99dd, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -39.089523
|
||||
value: -38.8252
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8574288191223281125, guid: b7611ec9c156a6d40ae4a76a0def99dd, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
|
@ -19,15 +19,12 @@ public class PlayerBehavior : MonoBehaviour
|
||||
|
||||
[Header("Clarinet:")]
|
||||
bool unlockedClarinet;
|
||||
[SerializeField] private float maxDashTime = 2.5f;
|
||||
[SerializeField] private float dashStopSpeed = 0.1f;
|
||||
public Vector3 moveDirection;
|
||||
public float dashDistance = 0.1f;
|
||||
private float currentDashTime;
|
||||
public bool isDash = false;
|
||||
public float bonk = 2f;
|
||||
private Vector2 saveVelocity;
|
||||
public bool isInWater = false;
|
||||
public float dashForce = 1.5f;
|
||||
|
||||
[Header("Grappling:")]
|
||||
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
||||
@ -100,21 +97,20 @@ public class PlayerBehavior : MonoBehaviour
|
||||
if (playerInput.actions["ClarinetDive"].WasPressedThisFrame())
|
||||
{
|
||||
isDash = true;
|
||||
currentDashTime = 0.0f;
|
||||
playerInput.DeactivateInput();
|
||||
}
|
||||
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime) && isDash)
|
||||
if (!playerController.IsGrounded() && isDash)
|
||||
{
|
||||
if (forward == 1)
|
||||
{
|
||||
moveDirection = new Vector3(1f, -1f, 0f) * dashDistance;
|
||||
Vector2 rightDash = new Vector2(1f, -1f) * dashForce;
|
||||
_rb.AddForce(rightDash, ForceMode2D.Impulse);
|
||||
}
|
||||
else
|
||||
{
|
||||
moveDirection = new Vector3(-1f, -1f, 0f) * dashDistance;
|
||||
Vector2 leftDash = new Vector2(-1f, -1f) * dashForce;
|
||||
_rb.AddForce(leftDash, ForceMode2D.Impulse);
|
||||
}
|
||||
transform.position = transform.position + moveDirection;
|
||||
currentDashTime += dashStopSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -286,6 +282,7 @@ public class PlayerBehavior : MonoBehaviour
|
||||
else if (col.tag == "water")
|
||||
{
|
||||
isInWater = false;
|
||||
saveVelocity = Vector2.zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,10 +310,10 @@ public class PlayerMovement : MonoBehaviour
|
||||
//Caps maximum fall speed, so when falling over large distances we don't accelerate to insanely high speeds
|
||||
RB.velocity = new Vector2(RB.velocity.x, Mathf.Max(RB.velocity.y, -Data.maxFallSpeed));
|
||||
}
|
||||
/*else if (playerBehavior.isInWater)
|
||||
else if (playerBehavior.isInWater)
|
||||
{
|
||||
SetGravityScale(0);
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
//Default gravity if standing on a platform or moving upwards
|
||||
|
Loading…
Reference in New Issue
Block a user