Update() public method

public Update ( float time ) : void
time float
return void
コード例 #1
0
    void Update()
    {
        isWalking = !check.IsStopped();
        side      = mover.Side;

        var newName = GetAnimName();

        if (string.IsNullOrEmpty(animName) || newName != animName)
        {
            animName = newName;
            anim.Play(animName);
        }

        check.Update(Time.deltaTime);
    }
コード例 #2
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();
        }
    }
コード例 #3
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);
    }