public Vector2 Update() { if (InputWrapper.GetJumpDown()) { var jumpV = Quaternion.Euler(0, 0, wallJumpAngle * Mathf.Sign(super.wallNormal)) * new Vector2(0, wallJumpSpeed); vel = jumpV; super.pmove.Reset(); super.partsys.Play(); super.pjump.SetJumpSpeedCur(jumpV); super.pjump.jumping = true; super.pjump.jumpTime = wallJumpTime; super.pjump.jumpCount = 1; //preventDir = wallNormal < 0 ? -1 : 1; } else { vel = Vector2.zero; } return(vel); }
public Vector2 Update() { if (jumpCount < jumpsMax && !jumping) // init { if ((super.isGrounded && InputWrapper.GetJumpBuffered() && jumpCount == 0) || InputWrapper.GetJumpDown()) // first jump is buffered { jumping = true; super.partsys.Play(); jumpTime = jumpTimeMax[jumpCount]; jumpSpeedCur = new Vector2(0, jumpSpeed[jumpCount]); } } if (jumping) { if (jumpTime > 0 && InputWrapper.GetJump()) { super.overrideVel.y = jumpSpeedCur.y; vel.x = jumpSpeedCur.x; jumpTime -= Time.fixedDeltaTime; } else // end jump { jumpTime = 0; jumping = false; jumpCount++; vel = Vector2.zero; } } return(vel); }