new dash
This commit is contained in:
parent
f7d45185fa
commit
8d230a5a71
@ -19,13 +19,12 @@ public class PlayerBehavior : MonoBehaviour
|
||||
|
||||
[Header("Clarinet:")]
|
||||
bool unlockedClarinet;
|
||||
[SerializeField] private float dashMult = 2;
|
||||
[SerializeField] private float maxDashTime = 2.0f;
|
||||
[SerializeField] private float dashStopSpeed = 0.01f;
|
||||
[SerializeField] private float maxDashTime = 3.0f;
|
||||
[SerializeField] private float dashStopSpeed = 0.1f;
|
||||
public Vector3 moveDirection;
|
||||
public float dashDistance = 0.2f;
|
||||
private float currentDashTime;
|
||||
public bool isDash = false;
|
||||
public Vector3 moveDirection;
|
||||
public float dashDistance = 0.1f;
|
||||
|
||||
[Header("Grappling:")]
|
||||
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
||||
|
@ -50,12 +50,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
bool wasGrappling = false;
|
||||
bool unlockedTrumpet;
|
||||
|
||||
//clarinet
|
||||
public bool isDashing = false;
|
||||
private float tempGrav;
|
||||
private float tempFall;
|
||||
private bool isFrozen = false;
|
||||
|
||||
//Set all of these up in the inspector
|
||||
[Header("Checks")]
|
||||
//Size of groundCheck depends on the size of your character generally you want them slightly small than width (for ground) and height (for the wall check)
|
||||
@ -94,7 +88,7 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
void OnMove(InputValue value)
|
||||
{
|
||||
if (playerBehavior.playerIsAlive && !isDashing) {
|
||||
if (playerBehavior.playerIsAlive) {
|
||||
this._moveInput = value.Get<Vector2>();
|
||||
} else {
|
||||
this._moveInput = Vector2.zero;
|
||||
@ -103,7 +97,7 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
void OnJump()
|
||||
{
|
||||
if (playerBehavior.playerIsAlive && !isDashing) {
|
||||
if (playerBehavior.playerIsAlive) {
|
||||
OnJumpInput();
|
||||
}
|
||||
}
|
||||
@ -265,11 +259,11 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
#region GRAVITY
|
||||
//Higher gravity if we've released the jump input or are falling
|
||||
if (IsSliding)
|
||||
{
|
||||
SetGravityScale(0);
|
||||
}
|
||||
else if (RB.velocity.y < 0 && _moveInput.y < 0)
|
||||
// if (IsSliding)
|
||||
// {
|
||||
// SetGravityScale(0);
|
||||
// }
|
||||
if (RB.velocity.y < 0 && _moveInput.y < 0)
|
||||
{
|
||||
//Much higher gravity if holding down
|
||||
SetGravityScale(Data.gravityScale * Data.fastFallGravityMult);
|
||||
@ -318,11 +312,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
if (trumpet == 0) {
|
||||
gameUI.ToggleTrumpet(false);
|
||||
}
|
||||
/*if (isDashing)
|
||||
{
|
||||
gameUI.ToggleClarinet(false);
|
||||
print("toggle clarinet false?");
|
||||
}*/
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -364,7 +353,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
#region RUN METHODS
|
||||
private void Run(float lerpAmount)
|
||||
{
|
||||
if(!isDashing){
|
||||
//Calculate the direction we want to move in and our desired velocity
|
||||
float targetSpeed = _moveInput.x * Data.runMaxSpeed;
|
||||
//We can reduce are control using Lerp() this smooths changes to are direction and speed
|
||||
@ -418,7 +406,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
* RB.velocity = new Vector2(RB.velocity.x + (Time.fixedDeltaTime * speedDif * accelRate) / RB.mass, RB.velocity.y);
|
||||
* Time.fixedDeltaTime is by default in Unity 0.02 seconds equal to 50 FixedUpdate() calls per second
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
private void Turn()
|
||||
@ -435,7 +422,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
#region JUMP METHODS
|
||||
private void Jump()
|
||||
{
|
||||
if(!isDashing){
|
||||
//Ensures we can't call Jump multiple times from one press
|
||||
LastPressedJumpTime = 0;
|
||||
LastOnGroundTime = 0;
|
||||
@ -450,7 +436,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
RB.AddForce(Vector2.up * force, ForceMode2D.Impulse);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
private void WallJump(int dir)
|
||||
|
Loading…
Reference in New Issue
Block a user