void Update() { _inputs = Vector3.zero; _inputs.x = input.LeftStickHorizontal(); _inputs.z = input.LeftStickVertical(); _inputs *= speed * Time.deltaTime; if (input.DashButtonDown() && !isDashing) { effects.PlayDashAudio(); timeForDash = 0f; isDashing = true; } if (timeForDash > dashTime) { isDashing = false; } if (isDashing) { timeForDash += Time.deltaTime; _inputs.Normalize(); _inputs *= dashSpeed; } hit.isDashing = isDashing; _inputs.y = gravity; cc.Move(_inputs); // apply the impact force: if (impact.magnitude > 0.2) { cc.Move(impact * Time.deltaTime); } // consumes the impact energy each cycle: impact = Vector3.Lerp(impact, Vector3.zero, 5 * Time.deltaTime); }