Esempio n. 1
0
    private void Move()
    {
        isGroundEnter = ground.IsGroundEnter();
        isGround      = ground.IsGround();
        isHead        = head.IsHead();

        float x = Input.GetAxis("Horizontal");

        if (isGroundEnter || isHead)
        {
            velY = 0;
        }
        if (isGround)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                velY = jumpPower;
            }
        }
        else
        {
            velY -= gravity;
        }

        transform.Translate(velocity.x * x * speed * Time.deltaTime, velocity.y * velY * Time.deltaTime, 0);
    }
Esempio n. 2
0
    private void Move()
    {
        isGroundEnter = ground.IsGroundEnter();
        isGround      = ground.IsGround();
        isHead        = head.IsHead();

        if (isGroundEnter || isHead)
        {
            velY = 0;
        }
        if (isGround)
        {
        }
        else
        {
            velY -= gravity;
        }

        transform.Translate(velocity.x * velX * speed * Time.deltaTime, velocity.y * velY * Time.deltaTime, 0);
    }