IsStoppedAndReset() public method

public IsStoppedAndReset ( ) : bool
return bool
Ejemplo n.º 1
0
    void Update()
    {
        if (checkWalking.IsWaking())
        {
            passedTime += Time.deltaTime;
            runAudioSource.PlayIfNotPlaying();
        }
        else if (checkWalking.IsStoppedAndReset())
        {
            passedTime = 0;
            runAudioSource.Stop();
        }


        checkWalking.Update(Time.deltaTime);
        if (passedTime > secondsToBreath)
        {
            breathAudioSource.PlayIfNotPlaying();
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        var playerDistance = (transform.position - player.position).magnitude;

        if (grain != null)
        {
            if (playerDistance < minDistance)
            {
                var newGrain = (playerDistance * (maxGrain - minGrain)) / (minDistance);
                grain.intensity.value = maxGrain - newGrain; // Mathf.Clamp(newGrain, minGrain, maxGrain);
                currentGrain          = grain.intensity.value;
            }
            else
            {
                grain.intensity.value = minGrain;
            }
        }

        if (checkWalking.IsWaking() && playerDistance < minDistance)
        {
            if (playerDistance <= minMaxVolumeDistance)
            {
                audioSource.volume = 1;
            }
            else
            {
                audioSource.volume = 1 - (playerDistance / minDistance);
            }

            audioSource.PlayIfNotPlaying();
        }
        else if (checkWalking.IsStoppedAndReset())
        {
            audioSource.Stop();
        }

        checkWalking.Update(Time.deltaTime);
    }