protected override void SpaxUpdate() { ApplyGravity(); if (FP.Abs(condition.GetVelocity().x) < condition.GetMaxSpeed()) { if (Input.GetButton("Right")) { //condition.AddVelocityX(condition.GetAcceleration()); // Debug.Log("left"); if (FP.Abs(condition.GetVelocity().x + condition.GetAcceleration()) > condition.GetMaxSpeed()) { condition.SetVelocityX(condition.GetMaxSpeed()); } else { condition.AddVelocityX(condition.GetAcceleration()); } condition.SetFacing(1); sprite.flipX = false; } else if (Input.GetButton("Left")) { // condition.AddVelocityX(condition.GetAcceleration() * -1); //Debug.Log("right"); if (FP.Abs(condition.GetVelocity().x - condition.GetAcceleration()) > condition.GetMaxSpeed()) { condition.SetVelocityX(-condition.GetMaxSpeed()); } else { condition.AddVelocityX(condition.GetAcceleration() * -1); } condition.SetFacing(-1); sprite.flipX = true; } else { if (FP.Abs(condition.GetVelocity().x) <= condition.GetFriction()) { condition.SetVelocityX(FP.Zero); } else { condition.AddVelocityX(condition.GetFriction() * -1 * condition.Getfacing()); } } if (Input.GetButtonDown("Jump") /* && (condition.CanJump(wallJumpChecker.GetPosOfOther() - rb.position.x) > 0)*/) { //int hold = condition.CanJump((((wallJumpChecker.GetPosOfOther() - rb.position.x) * Input.GetAxis("Horizontal")) < 0) ? (wallJumpChecker.GetPosOfOther() - rb.position.x) : 0); int hold = condition.CanJump(this.WallJumpRef(wallJumpChecker.GetPosOfOther())); // condition.AddVelocityX(condition.GetAcceleration() * -1); if (hold > 0 && hold != 3) { Debug.Log(hold); condition.SetVelocityY(10); } } } rb.SetVelocity(condition.GetVelocity()); }