Esempio n. 1
0
    void Update()
    {
        if (id.IsHunter() || !id.IsThisPlayer())
        {
            return;
        }

        if (sprintCooldownTimer >= sprintCooldownTime && Input.GetButtonUp("Fire2"))
        {
            sprinting           = true;
            sprintCooldownTimer = 0;
            movement.StartSprint();
            sfxManager.PlaySprint();
        }

        if (sprinting)
        {
            if (sprintTimer < sprintDuration)
            {
                sprintTimer += Time.deltaTime;
            }
            else if (sprintTimer >= sprintDuration)
            {
                movement.StopSprint();
                sprintTimer = 0;
                sprinting   = false;
            }
        }
        else
        {
            if (sprintCooldownTimer < sprintCooldownTime)
            {
                sprintCooldownTimer += Time.deltaTime;
            }
        }

        UIManager.instance.UpdateProgress((sprintCooldownTimer / sprintCooldownTime) * 100);
        ui.SetProgress((sprintCooldownTimer / sprintCooldownTime) * 100);
    }