Exemplo n.º 1
0
    public void UpdateGraph(FunctionLibrary.FunctionData functionData)
    {
        float time = Time.time;
        float v    = 0.5f * this.grad - 1f;
        float u    = 0f;

        for (int i = 0, x = 0, z = 0; i < maximumUnit * maximumUnit; i++, x++)
        {
            u = (x + 0.5f) * this.grad - 1f;
            if (x == maximumUnit)
            {
                x = 0;
                z++;
                v = (z + 0.5f) * this.grad - 1f;
            }

            if (isTransitioning && this.currentLerpDuration < this.LerpDuration)
            {
                points[i].transform.localPosition = FunctionLibrary.MorphGraphs(u, v, time,
                                                                                FunctionLibrary.GetFunction(this.function).function,
                                                                                functionData.function,
                                                                                this.currentLerpDuration / LerpDuration);
            }
            else
            {
                points[i].transform.localPosition = functionData.function(u, v, time);
                this.isTransitioning = false;
            }
        }


        if (isTransitioning)
        {
            this.currentLerpDuration += Time.deltaTime;
            //this.function = FunctionLibrary.GetFunction(this.function).functionName;
        }
        else
        {
            this.currentLerpDuration = 0;
            this.function            = functionData.functionName;
        }
    }