private void FixedUpdate() { if (!running) { return; } if (checkPointIndex < points.Length) { Vector2 heroPos = heroController.transform.position; Vector2 distance = points[checkPointIndex] + heroGoPos - heroPos; if (distance.magnitude <= 0.5) { //Log("Passed Waypoint " + checkPointIndex); checkPointIndex++; } distance.Normalize(); distance.Scale(new Vector2(speed, speed)); heroController.cState.falling = false; heroResetAttacksFunction?.Invoke(heroController, null); heroRb2d.velocity = distance; heroController.current_velocity = distance; } else { heroController.cState.falling = true; heroController.cState.doubleJumping = false; heroController.cState.dashing = false; heroController.cState.backDashing = false; heroController.cState.preventDash = false; heroController.SetAttr("doubleJump_steps", 0); heroController.SetAttr("dash_timer", 0.0f); heroController.SetAttr("airDashed", false); heroController.SetAttr("doubleJumped", false); heroController.hero_state = ActorStates.airborne; heroController.AffectedByGravity(true); if (currentSecondsDelayBeforeInputAccepting < secondsDelayBeforeInputAccepting) { currentSecondsDelayBeforeInputAccepting += Time.fixedDeltaTime; } else { running = false; _moving = false; heroController.AcceptInput(); } } }