public void OnUpdate() { if (!CheckInterrupt()) { float perc = (float)((FixMath.Abs(cInput.LeftStick().axis.X) - cController.cacheGM.gameInfo.walkSensitivity) / (Fix.One - cController.cacheGM.gameInfo.walkSensitivity)); Vector2 wantedSpeed = new Vector2(); wantedSpeed.x = (cController.vars.facingRight ? 1 : -1) * Mathf.Lerp((float)cController.cInfo.attributes.minWalkSpeed, (float)cController.cInfo.attributes.walkSpeed, perc); Vector2 currentSpeed = (Vector2)cController.kineticEnergies.horizontal; currentSpeed = Vector2.Lerp(currentSpeed, wantedSpeed, (float)cController.cInfo.attributes.walkAcceleration); cController.kineticEnergies.horizontal = (FixVec2)currentSpeed; cController.HandleForces(); } }
public bool CheckInterrupt() { GameInfo gi = cController.cacheGM.gameInfo; if (cController.CheckForAttack()) { return(true); } else if (FixMath.Abs(cInput.LeftStick().axis.X) >= gi.walkSensitivity) { cController.ChangeState("Walk"); return(true); } return(false); }