예제 #1
0
    void onPlayerMoves(Vector2 direction)
    {
        Vector2 normalizedDirection = direction.normalized;
        float   magnitude           = direction.magnitude;
        float   viewDistance        = Mathf.Clamp(SmoothStart.SmoothStart2(magnitude / maxDistance), 0, maxViewDistance);

        playerDirection = new Vector3(normalizedDirection.x, 0, normalizedDirection.y) * viewDistance;
    }
예제 #2
0
    IEnumerator dissolveParticles()
    {
        float elapsedTime = 0;

        setShaderMin(0);
        while (elapsedTime < countdownTime)
        {
            setShaderMin(Mathf.Lerp(0, 1, SmoothStart.SmoothStart2(elapsedTime / dissolveTime)));
            yield return(null);

            elapsedTime += Time.deltaTime;
        }
        setShaderMin(1);
    }
    IEnumerator transparencyFadeOut()
    {
        float elapsedTime = 0;

        material.SetFloat(GeneralVariables.ShaderTransparency, 1);

        while (elapsedTime + Mathf.Epsilon < fadeOutTime)
        {
            material.SetFloat(GeneralVariables.ShaderTransparency, Mathf.Lerp(1, 0, SmoothStart.SmoothStart2(elapsedTime / fadeOutTime)));
            yield return(null);

            elapsedTime += Time.deltaTime;
        }
        material.SetFloat(GeneralVariables.ShaderTransparency, 0);
    }