public void CalculateControls() { run = settings.GetRunVars(); jump = settings.GetJumpVars(); wallSlide = settings.GetWallSlideVars(); energy = settings.GetEnergyVars(); wallRun = settings.GetWallRunVars(); }
public JumpVars GetJumpVars() { JumpVars vars = new JumpVars(); // 0.5 a t^2 + b t = h // a t + b = 0 // b = -a t // 0.5 a t^2 - a t^2 = h // -0.5 a t^2 = h => a = -0.5 h / t^2 vars.minGravity = maxJumpHeight / (0.5f * secondsToApex * secondsToApex); vars.launchSpeed = vars.minGravity * secondsToApex; // 0.5 c t^2 + b t = h // c t + b = 0 // t = -b / c // 0.5 b^2 / c - b^2 / c = h // (-0.5 b^2) /c = h // c = (-0.5 b^2) / h vars.maxGravity = 0.5f * vars.launchSpeed * vars.launchSpeed / minJumpHeight; vars.coyoteTolerance = coyoteFrames * Time.fixedDeltaTime; vars.inputTolerance = jumpBuffer * Time.fixedDeltaTime; vars.deathVelocity = deathVelocity; return(vars); }