// Start is called before the first frame update void Start() { t = 0f; startPos = transform.position; sprite = transform.Find("Sprite"); origScale = sprite.localScale; JumpEffect effect = GetComponent <JumpEffect>(); effect.duration = duration; effect.PlayEffect(); }
public void OnJumpInputDown() { if (canWallSlide && wallSliding) { if (wallDirX == directionalInput.x) { velocity.x = -wallDirX * wallJumpClimb.x; velocity.y = wallJumpClimb.y; } else if (directionalInput.x == 0) { velocity.x = -wallDirX * wallJumpOff.x; velocity.y = wallJumpOff.y; } else { velocity.x = -wallDirX * wallLeap.x; velocity.y = wallLeap.y; } isDoubleJumping = false; } if (IsGrounded()) { velocity.y = maxJumpVelocity; isDoubleJumping = false; platformManager.Peel(); audioSource.PlayOneShot(jumpSound); anim.SetInteger("animationState", 2); jumpEffect.PlayEffect(); } if (canDoubleJump && !IsGrounded() && !isDoubleJumping && !wallSliding) { velocity.y = maxJumpVelocity; isDoubleJumping = true; } }