dash is working better!

This commit is contained in:
allylikesfrogs 2023-05-03 11:53:37 -07:00
parent 6fda5e48b5
commit f7d45185fa
3 changed files with 12072 additions and 265 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,12 +20,12 @@ public class PlayerBehavior : MonoBehaviour
[Header("Clarinet:")]
bool unlockedClarinet;
[SerializeField] private float dashMult = 2;
[SerializeField] private float maxDashTime = 5.0f;
[SerializeField] private float maxDashTime = 2.0f;
[SerializeField] private float dashStopSpeed = 0.01f;
private float currentDashTime;
public bool isDash = false;
public Vector2 moveDirection;
public float dashDistance = 5;
public Vector3 moveDirection;
public float dashDistance = 0.1f;
[Header("Grappling:")]
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
@ -104,17 +104,17 @@ public class PlayerBehavior : MonoBehaviour
currentDashTime = 0.0f;
playerInput.DeactivateInput();
}
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime))
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime) && isDash)
{
if(forward == 1)
{
moveDirection = transform.right * dashDistance;
moveDirection = new Vector3(1f,-1f,0f) * dashDistance;
}
else
{
moveDirection = -(transform.right) * dashDistance;
moveDirection = new Vector3(-1f,-1f,0f) * dashDistance;
}
//_rb.AddForce(dashSpeed, ForceMode2D.Force);
transform.position = transform.position + moveDirection;
currentDashTime += dashStopSpeed;
print("cdt " + currentDashTime);
}

View File

@ -110,20 +110,6 @@ public class PlayerMovement : MonoBehaviour
private void Update()
{
isDashing = playerBehavior.isDash;
if(isDashing)
{
FreezeControl();
}
else{
if(isFrozen)
{
Data.gravityStrength = tempGrav;
Data.fallGravityMult = tempFall;
isFrozen = false;
}
unlockedTrumpet = stateController.unlockedTrumpet;
#region TIMERS
LastOnGroundTime -= Time.deltaTime;
@ -339,11 +325,9 @@ public class PlayerMovement : MonoBehaviour
}*/
#endregion
}
}
private void FixedUpdate()
{
if(!isDashing){
//Handle Run
if (IsWallJumping)
Run(Data.wallJumpRunLerp);
@ -354,21 +338,6 @@ public class PlayerMovement : MonoBehaviour
if (IsSliding)
Slide();
}
}
void FreezeControl()
{
if(!isFrozen)
{
tempGrav = Data.gravityStrength;
tempFall = Data.fallGravityMult;
}
Data.gravityStrength = 0;
Data.fallGravityMult = 0;
isFrozen = true;
}
#region INPUT CALLBACKS
//Methods which whandle input detected in Update()