void Move(float force) { if (!canMove) { return; } currentSpeed = BMath.Smoothstep1D(currentSpeed, force, col.OnGround ? accelerationGrounded : accelerationAirbone); rb.velocity = new Vector2(currentSpeed, rb.velocity.y); }
public void MoveHorizontally(Vector2 direction) { TargetSpeed = direction.x * moveSpeed; CurrentSpeed = BMath.Smoothstep1D(CurrentSpeed, TargetSpeed, (Col.OnGround ? accelerationGrounded : accelerationAirbone) * Time.deltaTime); Rb.velocity = new Vector2(CurrentSpeed, Rb.velocity.y); if (direction.x > 0 && !facingRight || direction.x < 0 && facingRight) { Flip(); } }
public static string sIP2IP(string sIP, IPv4Type sIPType) { uint numAddress = (uint)BMath.BaseNToBase10(sIP, GetBaseN(sIPType)); return(Num2IP(numAddress)); }
public static string IP2sIP(string IP, IPv4Type sIPType) { return(BMath.Base10ToBaseN(IP2Num(IP), GetBaseN(sIPType))); }
public static T ModIndex <T>(this T[] arr, int index) => arr[BMath.Mod(arr.Length, index)];
public Environment() { Output = new Output(); EmptyArgs = new SArgs(this); True = new LBoolean(this, true); False = new LBoolean(this, false); Undefined = new LUndefined(this); Null = new LNull(this); GlobalObject = new BGlobal(this); GlobalEnvironment = new SLexicalEnvironment(this, new SObjectEnvironmentRecord(this, GlobalObject, false), null); MathObject = new BMath(this); JsonObject = new BJson(this); ObjectConstructor = new CObject(this); FunctionConstructor = new CFunction(this); ArrayConstructor = new CArray(this); StringConstructor = new CString(this); BooleanConstructor = new CBoolean(this); NumberConstructor = new CNumber(this); DateConstructor = new CDate(this); RegExpConstructor = new CRegExp(this); ErrorConstructor = new CError(this); EvalErrorConstructor = new CEvalError(this); RangeErrorConstructor = new CRangeError(this); ReferenceErrorConstructor = new CReferenceError(this); SyntaxErrorConstructor = new CSyntaxError(this); TypeErrorConstructor = new CTypeError(this); UriErrorConstructor = new CUriError(this); ObjectPrototype = new PObject(this); FunctionPrototype = new PFunction(this); ArrayPrototype = new PArray(this); StringPrototype = new PString(this); BooleanPrototype = new PBoolean(this); NumberPrototype = new PNumber(this); DatePrototype = new PDate(this); RegExpPrototype = new PRegExp(this); ErrorPrototype = new PError(this); EvalErrorPrototype = new PEvalError(this); RangeErrorPrototype = new PRangeError(this); ReferenceErrorPrototype = new PReferenceError(this); SyntaxErrorPrototype = new PSyntaxError(this); TypeErrorPrototype = new PTypeError(this); UriErrorPrototype = new PUriError(this); GlobalObject.Initialize(); MathObject.Initialize(); JsonObject.Initialize(); ObjectConstructor.Initialize(); FunctionConstructor.Initialize(); ArrayConstructor.Initialize(); StringConstructor.Initialize(); BooleanConstructor.Initialize(); NumberConstructor.Initialize(); DateConstructor.Initialize(); RegExpConstructor.Initialize(); ErrorConstructor.Initialize(); EvalErrorConstructor.Initialize(); RangeErrorConstructor.Initialize(); ReferenceErrorConstructor.Initialize(); SyntaxErrorConstructor.Initialize(); TypeErrorConstructor.Initialize(); UriErrorConstructor.Initialize(); ObjectPrototype.Initialize(); FunctionPrototype.Initialize(); ArrayPrototype.Initialize(); StringPrototype.Initialize(); BooleanPrototype.Initialize(); NumberPrototype.Initialize(); DatePrototype.Initialize(); RegExpPrototype.Initialize(); ErrorPrototype.Initialize(); EvalErrorPrototype.Initialize(); RangeErrorPrototype.Initialize(); ReferenceErrorPrototype.Initialize(); SyntaxErrorPrototype.Initialize(); TypeErrorPrototype.Initialize(); UriErrorPrototype.Initialize(); }
public T SafeIndexFromBack(int ii) { ii = BMath.Clamp(1, Count, ii); return(arr[BMath.Mod(arr.Length, pointer - ii)]); }