예제 #1
0
    void FixedUpdate()
    {
        horizontalMoving = Input.GetAxisRaw("Horizontal");
        verticalMoving   = Input.GetAxisRaw("Vertical");



        if (horizontalMoving != 0 || verticalMoving != 0)
        {
            moving = true;

            if (horizontalMoving != 0)
            {
                transform.Translate(horizontalMoving * playerStats.CurrentMOV_SPD * Time.deltaTime, 0f, 0f);
                transform.localScale = new Vector2(horizontalMoving, transform.localScale.y);
                faceDirection        = horizontalMoving;
            }


            if (verticalMoving != 0)
            {
                transform.Translate(0f, verticalMoving * playerStats.CurrentMOV_SPD * Time.deltaTime, 0f);
            }
        }
        else
        {
            moving = false;
        }


        if (Input.GetKey(KeyCode.LeftControl) && attackCountdown <= 0)
        {
            combat.AttackEvent();
            attackCountdown = 10f / playerStats.CurrentATT_SPD;
        }
    }