Exemplo n.º 1
0
    private void Update()
    {
        if (Time.timeScale == 0)
        {
            if (footsteps.isPlaying)
            {
                footsteps.Stop();
            }
            return;
        }
        // Alcohol effects
        float alcohol = PlayerStats.alcohol;

        weaponCamera.BlockCount = 512.0f - (alcohol / PlayerStats.GetAlcoholLimit()) * 384.0f;

        tick += Time.deltaTime;

        if (tick > 0.25f)
        {
            tick -= 0.25f;

            if (PlayerStats.healTime > 0.0f)
            {
                PlayerStats.Heal(healPerTick);
            }
            PlayerStats.RemoveHealTime(0.25f);
        }

        // At one point I want to check the type of the ground and if the player is grounded.
        if (character.velocity.magnitude >= 1.0f && !footsteps.isPlaying)
        {
            footsteps.Play();
        }
        else if (character.velocity.magnitude < 1.0f && footsteps.isPlaying)
        {
            footsteps.Stop();
        }

        // I update the randomness here.
        FakeControls.Update();
        FakeControls.SetRandomness(alcohol / PlayerStats.GetAlcoholLimit() * 0.5f);
    }