public InputGroundBasedWalk2D(GroundBasedAcceleration2D acceleratorWalk, float acceleration, string inputName = "Horizontal") { this.acceleratorWalk = acceleratorWalk; this.acceleration = acceleration; this.inputName = inputName; }
public InputPlatformer(Mover2D mover, Rigidbody2D rb, Angle upAngle, float gravityAcceleration, Angle maxSlopeAngle, float groundDeceleration, float maxHorizontalSpeed, float groundAcceleration, string groundInputName, float jumpVelocity, KeyCode buttonJump, float variableJumpDampFactor) { upDirection = new UpDirection2D(upAngle); vius = new VelocityInUpSpace2D(mover, upDirection); gravity = new Gravity2D(vius, gravityAcceleration); groundChecker = new GroundChecker2D(rb, upDirection, maxSlopeAngle); gba = new GroundBasedAcceleration2D(groundChecker, vius, groundDeceleration, maxHorizontalSpeed); igba = new InputGroundBasedWalk2D(gba, groundAcceleration, groundInputName); gbj = new GroundBasedJump2D(groundChecker, vius); igbj = new InputGroundBasedJump2D(gbj, jumpVelocity, buttonJump); variableJumping = new InputVariableJump2D(vius, gravity, variableJumpDampFactor, buttonJump); gbj.SubscribeToJumped(x => variableJumping.ResetVariableJump()); }