Exemplo n.º 1
0
 public InputVariableJump2D(VelocityInUpSpace2D vius, Gravity2D gravity,
                            float variableJumpDampFactor, KeyCode buttonJump)
 {
     this.vius    = vius;
     this.gravity = gravity;
     this.variableJumpDampFactor = variableJumpDampFactor;
     this.buttonJump             = buttonJump;
 }
Exemplo n.º 2
0
    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());
    }