コード例 #1
0
    private void Update()
    {
        if (LevelManager.instance.freeze)
        {
            return;
        }
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");


        bool crouchPressed = Input.GetButtonDown("Crouch");
        bool running       = Input.GetButton("Sprint");


        if (crouchPressed)
        {
            movement.Crouch(isCrouching = !isCrouching);
        }

        if (audioClips.Length > 0)
        {
            CheckAudio(x, z, running);
            if (running)
            {
                float sprintTime = LevelManager.instance.Sprint();
                if (sprintTime > 0)
                {
                    StartCoroutine(SprintUntil(sprintTime));
                    sprinting = true;
                }
                running = sprinting;
            }
            movement.Sprint(running);
        }

        movement.Move(z, x, true);
    }