Ejemplo n.º 1
0
    private void Update()
    {
        if (AnimationDir == 1)
        {
            T += Time.deltaTime * AnimationSpeed;
            if (T >= 1.0f)
            {
                T = 1.0f;
                if (ReverseOnFinish)
                {
                    AnimationDir = -1;
                }
                else
                {
                    AnimationDir = 0;
                }
            }
        }
        else if (AnimationDir == -1)
        {
            T -= Time.deltaTime * AnimationSpeed;
            if (T <= 0.0f)
            {
                T            = 0.0f;
                AnimationDir = 0;
            }
        }

        tr.localPosition = new Vector3(PosX.Evaluate(T), PosY.Evaluate(T), PosZ.Evaluate(T)) +
                           startPos;
        tr.localScale = new Vector3(startScale.x * ScaleX.Evaluate(T),
                                    startScale.y * ScaleY.Evaluate(T),
                                    startScale.z * ScaleZ.Evaluate(T));
        tr.localEulerAngles = new Vector3(tr.localEulerAngles.x, tr.localEulerAngles.y,
                                          startRot + Rot.Evaluate(T));
    }