Example #1
0
    void FixedUpdate()
    {
        v = Input.GetAxisRaw("Vertical");
        Vector2 velocity = rigid2d.velocity;

        Debug.Log(GameManager.clearDoor);

        if (velocity.y > 1)
        {
            anim.SetInteger("isJumpUp", 1);
        }
        else if (velocity.y < 1)
        {
            anim.SetInteger("isJumpUp", 2);
        }

        if (foot.isGround)
        {
            anim.SetInteger("isJumpUp", 0);
        }


        if ((Input.GetKey(KeyCode.Space)))
        {
            if (foot.isGround)
            {
                StartCoroutine(Jump(false));
            }
            else
            {
                if (foot.groundCnt > 0)
                {
                    StartCoroutine(Jump(true));
                }
            }
        }
        if (v == -1)
        {
            if (foot.isGround)
            {
                anim.SetInteger("isJumpUp", 3);
            }
        }

        if (doorDetect1.isDoor)
        {
            main.DoorDetected();
        }
        else
        {
            main.BackToOrigin();
        }
    }