public static void TestTween()
    {
        Roga2dNode node = new Roga2dNode();

        Roga2dAlphaInterval interval1 = new Roga2dAlphaInterval(node, 0.1f, 1.0f, 3, true);
        Roga2dRotationIntervalOption option = new Roga2dRotationIntervalOption();
        Roga2dRotationInterval interval2 = new Roga2dRotationInterval(node, 0.0f, 180.0f, 5, true,  option);

        List<Roga2dBaseInterval> intervals = new List<Roga2dBaseInterval>();
        intervals.Add(interval1);
        intervals.Add(interval2);
        Roga2dParallel parallel = new Roga2dParallel(intervals);

        parallel.Start();
        Tester.Match(node.LocalAlpha, 0.1f);
        Tester.Match(node.LocalRotation, 0.0f);
        Tester.Ok(!parallel.IsDone());

        parallel.Update();
        Tester.Match(node.LocalAlpha, 0.4f);
        Tester.Match(node.LocalRotation, 36.0f);
        Tester.Ok(!parallel.IsDone());

        parallel.Update();
        Tester.Match(node.LocalAlpha, 0.7f);
        Tester.Match(node.LocalRotation, 72.0f);
        Tester.Ok(!parallel.IsDone());

        parallel.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Match(node.LocalRotation, 108.0f);
        Tester.Ok(!parallel.IsDone());

        parallel.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Match(node.LocalRotation, 144.0f);
        Tester.Ok(!parallel.IsDone());

        parallel.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Match(node.LocalRotation, 180.0f);
        Tester.Ok(parallel.IsDone());

        parallel.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Match(node.LocalRotation, 180.0f);
        Tester.Ok(parallel.IsDone());

        parallel.Reset();
        Tester.Match(node.LocalAlpha, 0.1f);
        Tester.Match(node.LocalRotation, 0.0f);
        Tester.Ok(!parallel.IsDone());

        node.Destroy();
    }
    public static void TestTween()
    {
        Roga2dNode node = new Roga2dNode();

        Roga2dAlphaInterval interval1 = new Roga2dAlphaInterval(node, 0.1f, 1.0f, 3, true);
        Roga2dWait interval2 = new Roga2dWait(2);
        Roga2dAlphaInterval interval3 = new Roga2dAlphaInterval(node, 0.7f, 0.0f, 2, true);

        List<Roga2dBaseInterval> intervals = new List<Roga2dBaseInterval>();
        intervals.Add(interval1);
        intervals.Add(interval2);
        intervals.Add(interval3);

        Roga2dSequence sequence = new Roga2dSequence(intervals);

        sequence.Start();
        Tester.Match(node.LocalAlpha, 0.1f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 0.4f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 0.7f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 0.35f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 0.0f);
        Tester.Ok(sequence.IsDone());

        sequence.Reset();
        Tester.Match(node.LocalAlpha, 0.1f);
        Tester.Ok(!sequence.IsDone());

        node.Destroy();
    }
Esempio n. 3
0
    public static void Test2Loop()
    {
        Roga2dNode node = new Roga2dNode();

        Roga2dAlphaInterval interval1 = new Roga2dAlphaInterval(node, 0.1f, 1.0f, 1, true);
        Roga2dWait interval2 = new Roga2dWait(1);
        Roga2dAlphaInterval interval3 = new Roga2dAlphaInterval(node, 0.7f, 0.0f, 1, true);

        List<Roga2dBaseInterval> intervals = new List<Roga2dBaseInterval>();
        intervals.Add(interval1);
        intervals.Add(interval2);
        intervals.Add(interval3);

        Roga2dSequence sequence = new Roga2dSequence(intervals);
        Roga2dLoop loop = new Roga2dLoop(sequence, 2);

        loop.Start();
        Tester.Match(node.LocalAlpha, 0.1f);
        Tester.Ok(!loop.IsDone());

        loop.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Ok(!loop.IsDone());

        loop.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Ok(!loop.IsDone());

        loop.Update();
        Tester.Match(node.LocalAlpha, 0.1f);
        Tester.Ok(!loop.IsDone());

        loop.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Ok(!loop.IsDone());

        loop.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Ok(!loop.IsDone());

        loop.Update();
        Tester.Match(node.LocalAlpha, 0.0f);
        Tester.Ok(loop.IsDone());

        node.Destroy();
    }
    public static void TestTween()
    {
        Roga2dNode node = new Roga2dNode();
        Roga2dAlphaInterval interval = new Roga2dAlphaInterval(node, 0.0f, 1.0f, 5, true);

        Tester.Ok(!interval.IsDone());

        interval.Start();
        Tester.Match(node.LocalAlpha, 0.0f);
        Tester.Ok(!interval.IsDone());

        interval.Update();
        Tester.Match(node.LocalAlpha, 0.2f);
        Tester.Ok(!interval.IsDone());

        interval.Update();
        Tester.Match(node.LocalAlpha, 0.4f);
        Tester.Ok(!interval.IsDone());

        interval.Update();
        Tester.Match(node.LocalAlpha, 0.6f);
        Tester.Ok(!interval.IsDone());

        interval.Update();
        Tester.Match(node.LocalAlpha, 0.8f);
        Tester.Ok(!interval.IsDone());

        interval.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Ok(interval.IsDone());

        interval.Update();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Ok(interval.IsDone());

        interval.Reset();
        Tester.Match(node.LocalAlpha, 0.0f);
        Tester.Ok(!interval.IsDone());

        node.Destroy();
    }
    public static void TestMixTween()
    {
        Roga2dNode node = new Roga2dNode();

        Roga2dAlphaInterval interval1 = new Roga2dAlphaInterval(node, 1.0f, 0.5f, 1, false);
        Roga2dAlphaInterval interval2 = new Roga2dAlphaInterval(node, 0.5f, 0.3f, 1, false);
        Roga2dAlphaInterval interval3 = new Roga2dAlphaInterval(node, 0.3f, 0.1f, 1, true);
        Roga2dAlphaInterval interval4 = new Roga2dAlphaInterval(node, 0.1f, 0.1f, 1, true);

        List<Roga2dBaseInterval> intervals = new List<Roga2dBaseInterval>();
        intervals.Add(interval1);
        intervals.Add(interval2);
        intervals.Add(interval3);
        intervals.Add(interval4);

        Roga2dSequence sequence = new Roga2dSequence(intervals);

        sequence.Start();
        Tester.Match(node.LocalAlpha, 1.0f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 0.5f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 0.3f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 0.1f);
        Tester.Ok(!sequence.IsDone());

        sequence.Update();
        Tester.Match(node.LocalAlpha, 0.1f);
        Tester.Ok(sequence.IsDone());

        node.Destroy();
    }