dash is working better!
This commit is contained in:
parent
6fda5e48b5
commit
f7d45185fa
File diff suppressed because it is too large
Load Diff
@ -20,12 +20,12 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
[Header("Clarinet:")]
|
[Header("Clarinet:")]
|
||||||
bool unlockedClarinet;
|
bool unlockedClarinet;
|
||||||
[SerializeField] private float dashMult = 2;
|
[SerializeField] private float dashMult = 2;
|
||||||
[SerializeField] private float maxDashTime = 5.0f;
|
[SerializeField] private float maxDashTime = 2.0f;
|
||||||
[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 Vector3 moveDirection;
|
||||||
public float dashDistance = 5;
|
public float dashDistance = 0.1f;
|
||||||
|
|
||||||
[Header("Grappling:")]
|
[Header("Grappling:")]
|
||||||
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
||||||
@ -104,17 +104,17 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
currentDashTime = 0.0f;
|
currentDashTime = 0.0f;
|
||||||
playerInput.DeactivateInput();
|
playerInput.DeactivateInput();
|
||||||
}
|
}
|
||||||
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime))
|
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime) && isDash)
|
||||||
{
|
{
|
||||||
if(forward == 1)
|
if(forward == 1)
|
||||||
{
|
{
|
||||||
moveDirection = transform.right * dashDistance;
|
moveDirection = new Vector3(1f,-1f,0f) * dashDistance;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moveDirection = -(transform.right) * dashDistance;
|
moveDirection = new Vector3(-1f,-1f,0f) * dashDistance;
|
||||||
}
|
}
|
||||||
//_rb.AddForce(dashSpeed, ForceMode2D.Force);
|
transform.position = transform.position + moveDirection;
|
||||||
currentDashTime += dashStopSpeed;
|
currentDashTime += dashStopSpeed;
|
||||||
print("cdt " + currentDashTime);
|
print("cdt " + currentDashTime);
|
||||||
}
|
}
|
||||||
|
@ -110,20 +110,6 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
isDashing = playerBehavior.isDash;
|
|
||||||
if(isDashing)
|
|
||||||
{
|
|
||||||
FreezeControl();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
if(isFrozen)
|
|
||||||
{
|
|
||||||
Data.gravityStrength = tempGrav;
|
|
||||||
Data.fallGravityMult = tempFall;
|
|
||||||
isFrozen = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
unlockedTrumpet = stateController.unlockedTrumpet;
|
unlockedTrumpet = stateController.unlockedTrumpet;
|
||||||
#region TIMERS
|
#region TIMERS
|
||||||
LastOnGroundTime -= Time.deltaTime;
|
LastOnGroundTime -= Time.deltaTime;
|
||||||
@ -339,11 +325,9 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
}*/
|
}*/
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void FixedUpdate()
|
private void FixedUpdate()
|
||||||
{
|
{
|
||||||
if(!isDashing){
|
|
||||||
//Handle Run
|
//Handle Run
|
||||||
if (IsWallJumping)
|
if (IsWallJumping)
|
||||||
Run(Data.wallJumpRunLerp);
|
Run(Data.wallJumpRunLerp);
|
||||||
@ -354,21 +338,6 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
if (IsSliding)
|
if (IsSliding)
|
||||||
Slide();
|
Slide();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void FreezeControl()
|
|
||||||
{
|
|
||||||
if(!isFrozen)
|
|
||||||
{
|
|
||||||
tempGrav = Data.gravityStrength;
|
|
||||||
tempFall = Data.fallGravityMult;
|
|
||||||
}
|
|
||||||
|
|
||||||
Data.gravityStrength = 0;
|
|
||||||
Data.fallGravityMult = 0;
|
|
||||||
|
|
||||||
isFrozen = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region INPUT CALLBACKS
|
#region INPUT CALLBACKS
|
||||||
//Methods which whandle input detected in Update()
|
//Methods which whandle input detected in Update()
|
||||||
|
Loading…
Reference in New Issue
Block a user