示例#1
0
    public GroundChecker2D(Rigidbody2D rb, UpDirection2D upDirection, Angle maxSlopeAngle)
    {
        this.rb            = rb;
        this.upDirection   = upDirection;
        this.maxSlopeAngle = maxSlopeAngle;

        upDirection.UpAngleChanged += UpdateNormals;
        SetMaxSlopeAngle(maxSlopeAngle);
    }
示例#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());
    }
示例#3
0
 private void Awake()
 {
     upDirection = new UpDirection2D();
 }
示例#4
0
 public VelocityInUpSpace2D(Mover2D mover, UpDirection2D upDirection)
 {
     this.mover       = mover;
     this.upDirection = upDirection;
 }