private void FixedUpdate()
    {
        if (canMove == true)
        {
            transform.position += movement * moveSpeed * Time.fixedDeltaTime;

            if (rb.velocity.y < 0)
            {
                rb.velocity += Vector2.up * Physics2D.gravity.y * (fallMultiplier - 1) * Time.deltaTime;
            }
            else if (rb.velocity.y > 0 && !Input.GetButton("Jump"))
            {
                rb.velocity += Vector2.up * Physics2D.gravity.y * (lowJumpMultiplier - 1) * Time.deltaTime;
            }
        }

        //Check Ground should always run independant on whether canMove is TRUE or FALSE.
        //THis is bacause PowerUpBar is dependant on isGrounded.
        CheckGround();

        if (canMove == true)
        {
            playerAnimator.Move(movement.x != 0);
            int m = 1;
            if (isFacingRight && movement.x < 0 || !isFacingRight && movement.x > 0)
            {
                m = -1;
            }
            playerAnimator.Flip(m);
        }
    }
예제 #2
0
    IEnumerator IntroAnimation()
    {
        stopMoving = true;
        InputManager.disableInput = true;
        animController.Born();
        yield return(new WaitForSeconds(1.5f));

        InputManager.disableInput = false;
        stopMoving = false;
        animController.Move();
    }