Пример #1
0
 public void jump()    //Make player jump
 {
     pj.Jump();
 }
Пример #2
0
 void FixedUpdate()
 {
     ReceiveValues();
     Momentum_State();
     Immune_State();
     pJump.Unground(); //Delay for transition from grounded to airborne
     if (airborne)
     {
         if (wantToJump && jumpCount == 1 && doubleJump && jumpTimer <= 0.0f) //If player used 1st jump, pressed space and has access to double jump ability
         {
             pJump.DoubleJump();
         }
         if (velocity.y < 0.0f && !doubleJumping) //Triggers descending animation
         {
             Descend_State();
         }
         else
         {
             descending = false;
         }
     }
     else if (onGround)
     {
         if (momentumTimer > 0.0f || input.x == 0.0f || input.x != prevSign) //If player changes direction or stops moving while sprinting
         {
             if (sprinting)
             {
                 Pivot();
             }
         }
         if (onSlope) //If player is standing on a slope
         {
             Slope_State();
         }
         if (momentumTimer <= 0.0f) //If player has been running in same direction for more than momentumTime, sprint
         {
             Sprint();
         }
         if (wantToJump && timers.jumpTimer <= 0.0f) //Player inputted space up to 0.25 seconds ago
         {
             pJump.Jump();
         }
     }
     if (onWall)
     {
         Wall_State();
         if (!onGround && velocity.y <= 2.0f && wallStickTimer <= 0.0f && !wallSliding)
         //If player is on wall, not touching ground, has low vertical speed and the wall stick cooldown is over, attach to wall to perform a wall slide
         {
             wallActions.WallSlide();
         }
     }
     if (wallSliding)
     {
         Slide_State();
         wallActions.ManageWallSlide();
     }
     if (againstCeiling)
     {
         Ceiling_State();
     }
     else if (wallClimbing)
     {
         wallActions.ManageWallClimb();
     }
     else if (wallJumping)
     {
         wallActions.ManageWallJump();
     }
     else if (pivoting)
     {
         ManagePivot();
     }
     else if (attacking)
     {
         pAttack.ManageAttack();
     }
     else if (dashing)
     {
         pDash.ManageDash();
     }
     else if (dashAttacking)
     {
         pDash.ManageDashAttack();
     }
     else if (diving)
     {
         if (diveHit)
         {
             pDive.ManageDiveAttack();
         }
         else
         {
             pDive.ManageDive();
         }
     }
     else if (landing)
     {
         pDive.ManageLanding();
     }
     else if (stunned)
     {
         Stunned_State();
         pCol.ManageKnockback();
     }
     SendValues();
 }