This commit is contained in:
allylikesfrogs 2023-05-03 12:06:29 -07:00
parent f7d45185fa
commit 8d230a5a71
2 changed files with 11 additions and 27 deletions

View File

@ -19,13 +19,12 @@ public class PlayerBehavior : MonoBehaviour
[Header("Clarinet:")] [Header("Clarinet:")]
bool unlockedClarinet; bool unlockedClarinet;
[SerializeField] private float dashMult = 2; [SerializeField] private float maxDashTime = 3.0f;
[SerializeField] private float maxDashTime = 2.0f; [SerializeField] private float dashStopSpeed = 0.1f;
[SerializeField] private float dashStopSpeed = 0.01f; public Vector3 moveDirection;
public float dashDistance = 0.2f;
private float currentDashTime; private float currentDashTime;
public bool isDash = false; public bool isDash = false;
public Vector3 moveDirection;
public float dashDistance = 0.1f;
[Header("Grappling:")] [Header("Grappling:")]
[SerializeField] public Tutorial_GrapplingGun grapplingGun; [SerializeField] public Tutorial_GrapplingGun grapplingGun;

View File

@ -50,12 +50,6 @@ public class PlayerMovement : MonoBehaviour
bool wasGrappling = false; bool wasGrappling = false;
bool unlockedTrumpet; 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 //Set all of these up in the inspector
[Header("Checks")] [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) //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) void OnMove(InputValue value)
{ {
if (playerBehavior.playerIsAlive && !isDashing) { if (playerBehavior.playerIsAlive) {
this._moveInput = value.Get<Vector2>(); this._moveInput = value.Get<Vector2>();
} else { } else {
this._moveInput = Vector2.zero; this._moveInput = Vector2.zero;
@ -103,7 +97,7 @@ public class PlayerMovement : MonoBehaviour
void OnJump() void OnJump()
{ {
if (playerBehavior.playerIsAlive && !isDashing) { if (playerBehavior.playerIsAlive) {
OnJumpInput(); OnJumpInput();
} }
} }
@ -265,11 +259,11 @@ public class PlayerMovement : MonoBehaviour
#region GRAVITY #region GRAVITY
//Higher gravity if we've released the jump input or are falling //Higher gravity if we've released the jump input or are falling
if (IsSliding) // if (IsSliding)
{ // {
SetGravityScale(0); // SetGravityScale(0);
} // }
else if (RB.velocity.y < 0 && _moveInput.y < 0) if (RB.velocity.y < 0 && _moveInput.y < 0)
{ {
//Much higher gravity if holding down //Much higher gravity if holding down
SetGravityScale(Data.gravityScale * Data.fastFallGravityMult); SetGravityScale(Data.gravityScale * Data.fastFallGravityMult);
@ -318,11 +312,6 @@ public class PlayerMovement : MonoBehaviour
if (trumpet == 0) { if (trumpet == 0) {
gameUI.ToggleTrumpet(false); gameUI.ToggleTrumpet(false);
} }
/*if (isDashing)
{
gameUI.ToggleClarinet(false);
print("toggle clarinet false?");
}*/
#endregion #endregion
} }
@ -364,7 +353,6 @@ public class PlayerMovement : MonoBehaviour
#region RUN METHODS #region RUN METHODS
private void Run(float lerpAmount) private void Run(float lerpAmount)
{ {
if(!isDashing){
//Calculate the direction we want to move in and our desired velocity //Calculate the direction we want to move in and our desired velocity
float targetSpeed = _moveInput.x * Data.runMaxSpeed; float targetSpeed = _moveInput.x * Data.runMaxSpeed;
//We can reduce are control using Lerp() this smooths changes to are direction and speed //We can reduce are control using Lerp() this smooths changes to are direction and speed
@ -419,7 +407,6 @@ public class PlayerMovement : MonoBehaviour
* Time.fixedDeltaTime is by default in Unity 0.02 seconds equal to 50 FixedUpdate() calls per second * Time.fixedDeltaTime is by default in Unity 0.02 seconds equal to 50 FixedUpdate() calls per second
*/ */
} }
}
private void Turn() private void Turn()
{ {
@ -435,7 +422,6 @@ public class PlayerMovement : MonoBehaviour
#region JUMP METHODS #region JUMP METHODS
private void Jump() private void Jump()
{ {
if(!isDashing){
//Ensures we can't call Jump multiple times from one press //Ensures we can't call Jump multiple times from one press
LastPressedJumpTime = 0; LastPressedJumpTime = 0;
LastOnGroundTime = 0; LastOnGroundTime = 0;
@ -451,7 +437,6 @@ public class PlayerMovement : MonoBehaviour
RB.AddForce(Vector2.up * force, ForceMode2D.Impulse); RB.AddForce(Vector2.up * force, ForceMode2D.Impulse);
#endregion #endregion
} }
}
private void WallJump(int dir) private void WallJump(int dir)
{ {