Exemplo n.º 1
0
    public static void CalcBlendPctByFunc(BaseAlgorithm.EViewTargetBlendFunction inIndirectViewSightFunc, float inIndirectViewSightExp, float DurationPct, out float BlendPct)
    {
        BlendPct = 0f;
        switch (inIndirectViewSightFunc)
        {
        case BaseAlgorithm.EViewTargetBlendFunction.VTBlend_Linear:
            BlendPct = BaseAlgorithm.Lerp(0f, 1f, DurationPct);
            break;

        case BaseAlgorithm.EViewTargetBlendFunction.VTBlend_Cubic:
            BlendPct = BaseAlgorithm.CubicInterp(0f, 0f, 1f, 0f, DurationPct);
            break;

        case BaseAlgorithm.EViewTargetBlendFunction.VTBlend_EaseIn:
            BlendPct = BaseAlgorithm.FInterpEaseIn(0f, 1f, DurationPct, inIndirectViewSightExp);
            break;

        case BaseAlgorithm.EViewTargetBlendFunction.VTBlend_EaseOut:
            BlendPct = BaseAlgorithm.FInterpEaseOut(0f, 1f, DurationPct, inIndirectViewSightExp);
            break;

        case BaseAlgorithm.EViewTargetBlendFunction.VTBlend_EaseInOut:
            BlendPct = BaseAlgorithm.FInterpEaseInOut(0f, 1f, DurationPct, inIndirectViewSightExp);
            break;
        }
    }
Exemplo n.º 2
0
    public static float FInterpEaseInOut(float A, float B, float Alpha, float Exp)
    {
        float alpha;

        if (Alpha < 0.5f)
        {
            alpha = 0.5f * Mathf.Pow(2f * Alpha, Exp);
        }
        else
        {
            alpha = 1f - 0.5f * Mathf.Pow(2f * (1f - Alpha), Exp);
        }
        return(BaseAlgorithm.Lerp(A, B, alpha));
    }
Exemplo n.º 3
0
 public static float FInterpEaseOut(float A, float B, float Alpha, float Exp)
 {
     return(BaseAlgorithm.Lerp(A, B, Mathf.Pow(Alpha, 1f / Exp)));
 }