IsWaking() public method

public IsWaking ( ) : bool
return bool
Beispiel #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();
        }
    }
Beispiel #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);
    }