Ejemplo n.º 1
0
    private void Update()
    {
        onGround = Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, whatIsGround);

        if (move)
        {
            //////////////////////////////////// 점프
            if (Input.GetKeyDown("w") && onGround == true)
            {
                rb.velocity = new Vector2(rb.velocity.x, jumpForce);
                jumped      = true;
                anim.Jump();
            }

            if (rb.velocity.y == 0 && onGround == true)
            {
                jumped = false;
            }


            if (jetpack && onGround == false && Input.GetKeyDown("w") && fuel > 0 && !jetpack_overheated)
            {
                GetComponent <PlayerAudioManager>().Jetpack_SFX(true);
                usingJetpack  = true;
                fuel         -= jetpack_init_fuel;
                jetpack_heat += jetpack_init_heat_increase;
            }
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        float h = Input.GetAxis("Vertical");

        control.walk = h > 0;

        float wantedSpeed = Input.GetKey(KeyCode.LeftShift) ? 1 : 0;

        control.speed = Mathf.MoveTowards(control.speed, wantedSpeed, 1f * Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Space))
        {
            control.Jump();
        }
    }