Implemented charge cancelling
Stop charging with mouse 2 and still stick to things
This commit is contained in:
@@ -50,7 +50,7 @@ public class LurchMovement : MonoBehaviour {
|
||||
private bool stickToGround = false;
|
||||
[SerializeField]
|
||||
private float stickyOffset = 1;
|
||||
|
||||
private bool blockCharge = false;
|
||||
|
||||
[Header("Gliding")]
|
||||
public bool canGlide;
|
||||
@@ -125,7 +125,11 @@ public class LurchMovement : MonoBehaviour {
|
||||
|
||||
void JumpControl()
|
||||
{
|
||||
if (Input.GetButton("Fire1") && currentJumpForce < maxJumpForce)
|
||||
if (Input.GetButtonDown("Fire1"))
|
||||
{
|
||||
blockCharge = false;
|
||||
}
|
||||
if (Input.GetButton("Fire1") && currentJumpForce < maxJumpForce && cooldown <= 0 && !blockCharge )
|
||||
{
|
||||
currentJumpForce += forceIncreaseSpeed;
|
||||
lerpedColor = Color.Lerp(normalColor, fullyChargedColor, t);
|
||||
@@ -141,7 +145,7 @@ public class LurchMovement : MonoBehaviour {
|
||||
{
|
||||
lerpedColor = normalColor;
|
||||
t = 0.0f;
|
||||
currentSize = normalSize;
|
||||
currentSize = Vector3.Lerp(currentSize, normalSize, Time.deltaTime * 5f);
|
||||
|
||||
}
|
||||
|
||||
@@ -151,7 +155,7 @@ public class LurchMovement : MonoBehaviour {
|
||||
currentJumpForce = 0.0f;
|
||||
}
|
||||
|
||||
if (Input.GetButtonUp("Fire1")) {
|
||||
if (Input.GetButtonUp("Fire1") && cooldown <= 0 && !blockCharge) {
|
||||
cooldown = 0.5f;
|
||||
lurchBody.isKinematic = false;
|
||||
stickToGround = false;
|
||||
@@ -159,6 +163,12 @@ public class LurchMovement : MonoBehaviour {
|
||||
lurchBody.AddForce(theLurch.forward * currentJumpForce, ForceMode.Impulse);
|
||||
lurchBody.AddForce(theLurch.up * currentJumpForce * upForceModifier, ForceMode.Impulse);
|
||||
}
|
||||
else if (Input.GetButton("Fire2")) {
|
||||
currentJumpForce = 0.0f;
|
||||
cooldown = 0.5f;
|
||||
currentSize = Vector3.Lerp(currentSize, normalSize, Time.deltaTime * 5f);
|
||||
blockCharge = true;
|
||||
}
|
||||
else if (LurchOnGround() && Time.time > cooldown)
|
||||
{
|
||||
//stickToGround = true;
|
||||
|
||||
Reference in New Issue
Block a user