This commit is contained in:
allylikesfrogs
2023-05-03 08:15:59 -07:00
parent 3aa0823bbe
commit f1e2de295f
2 changed files with 43 additions and 15 deletions

View File

@@ -52,6 +52,9 @@ public class PlayerMovement : MonoBehaviour
//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")]
@@ -108,7 +111,19 @@ public class PlayerMovement : MonoBehaviour
private void Update()
{
isDashing = playerBehavior.isDash;
if(!isDashing){
if(isDashing)
{
FreezeControl();
}
else{
if(isFrozen)
{
Data.gravityStrength = tempGrav;
Data.fallGravityMult = tempFall;
isFrozen = false;
}
unlockedTrumpet = stateController.unlockedTrumpet;
#region TIMERS
LastOnGroundTime -= Time.deltaTime;
@@ -336,6 +351,20 @@ public class PlayerMovement : MonoBehaviour
}
}
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()
public void OnJumpInput()