Skip to content
Snippets Groups Projects
Commit d012913d authored by Henry's avatar Henry
Browse files

Quick slow mo fix.

parent f7f56a9a
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,8 @@ public class GM : MonoBehaviour
public static float impactVelocityTrigger;
private static bool Slowing = false;
public float SlowMoDuration = 0.3f;
private static float SlowMoTime;
public AnimationCurve SlowSpeedCurve;
private static AnimationCurve SlowingCurve;
......@@ -58,6 +60,7 @@ void Update()
comboScale = comboScaling;
maxCombo = maxComboMultiplier;
impactVelocityTrigger = SlowMoTriggerVelocity;
SlowMoTime = SlowMoDuration;
SlowingCurve = SlowSpeedCurve;
if (txtChildren[0]) { txtChildren[0].text = "Score: " + score; }
......@@ -132,31 +135,20 @@ public IEnumerator TallyScore()
}
}
public static IEnumerator SlowMo(float slowTime = 0.1f)
public static IEnumerator SlowMo()
{
if (!Slowing)
{
Slowing = true;
var currentSlow = 0f; var inc = 0.02f;
while (currentSlow < slowTime)
while (currentSlow < SlowMoTime)
{
currentSlow += inc;
yield return new WaitForSeconds(inc);
//Time.timeScale = Mathf.Lerp(1f, slowSpeed, currentSlow / slowDownTime);
Time.timeScale = SlowingCurve.Evaluate(currentSlow / slowTime);
Time.timeScale = SlowingCurve.Evaluate(currentSlow / SlowMoTime);
}
/*
currentSlow = 0f;
while (currentSlow < slowRecoveryTime)
{
currentSlow += inc;
yield return new WaitForSeconds(inc);
Time.timeScale = Mathf.Lerp(slowSpeed, 1f, currentSlow / slowRecoveryTime);
}
*/
Time.timeScale = 1f;
Slowing = false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment