private void CalculateDestination()
    {
        if (useLocalPosition)
        {
            float y = randomYRange.Random();
            animationCurve.EditKeyframeValue(0, new Vector3(Camera.main.transform.position.x + 10, y, 0));
            animationCurve.EditKeyframeValue(1, new Vector3(Camera.main.transform.position.x - 10, y, 0));
        }
        else
        {
            animationCurve.EditKeyframeValue(0, new Vector3(gameObjectToManipulate.transform.position.x, gameObjectToManipulate.transform.position.y, 0));
        }

        destination = animationCurve.Evaluate(animationCurve.MaxTime());
    }
Beispiel #2
0
    public void EditKeyframeValueVector3AnimationCurve()
    {
        var animationCurve = new CandyCoded.Vector3AnimationCurve();

        animationCurve.x = AnimationCurve.Linear(0, 0, 1, 1);
        animationCurve.y = AnimationCurve.Linear(0, 0, 1, 1);
        animationCurve.z = AnimationCurve.Linear(0, 0, 1, 1);

        animationCurve.EditKeyframeValue(0, new Vector3(10, 15, 20));

        Assert.AreEqual(10, animationCurve.x.keys[0].value);
        Assert.AreEqual(15, animationCurve.y.keys[0].value);
        Assert.AreEqual(20, animationCurve.z.keys[0].value);

        Assert.AreEqual(1, animationCurve.x.keys[1].value);
        Assert.AreEqual(1, animationCurve.y.keys[1].value);
        Assert.AreEqual(1, animationCurve.z.keys[1].value);
    }