示例#1
0
    public void RunLayoutFour()
    {
        _.Log("Layout four");
        var layout = new LinearPlanarSpread(target4);

        LayoutManager.Default.Add(Streams.STREAM_0, layout, factory, new TargetByComponent <DemoMarker>());
    }
示例#2
0
    public void Start()
    {
        var layout = new LinearPlanarSpread(plane);

        LayoutFactoryDelegate factory = (LayoutObject target) =>
        {
            var animation = new MoveSingle(target.position, target.rotation);
            animation.AnimationCurve  = new SineWave(period);
            animation.AnimationTarget = new TargetSingle(target.gameObject);
            return(animation);
        };

        AnimationManager.Default.Configure(Streams.STREAM_0, AnimationStreamType.DEFER, 16);
        LayoutManager.Default.Add(Streams.STREAM_0, layout, factory, new TargetByComponent <DemoMarker>());
    }
    public void test_layout()
    {
        LayoutManagerTests.Reset(this);

        AnimationManager.Default.Configure(Streams.STREAM_0, AnimationStreamType.DEFER, 30);

        var layout = new LinearPlanarSpread(this.SpawnBlank());

        LayoutFactoryDelegate factory = (LayoutObject target) =>
        {
            var animation = new MoveSingle(target.position, target.rotation);
            animation.AnimationCurve  = new Linear(1f);
            animation.AnimationTarget = new TargetSingle(target.gameObject);
            return(animation);
        };

        var targets = new GameObject[]
        {
            this.SpawnBlank(),
            this.SpawnBlank(),
            this.SpawnBlank(),
            this.SpawnBlank(),
            this.SpawnBlank(),
            this.SpawnBlank(),
        };

        LayoutManager.Default.Add(Streams.STREAM_0, layout, factory, new TargetGroup(targets));

        Assert(AnimationManager.Default.Streams.Active(Streams.STREAM_0));

        int count = 0;

        AnimationManager.Default.Events.AddEventHandler <LayoutCompleteEvent>((ep) => { count += 1; });

        AnimationHandler.Default.Update(0.5f);

        Assert(AnimationManager.Default.Streams.Active(Streams.STREAM_0));
        Assert(AnimationManager.Default.Streams.Active(Streams.STREAM_0));
        Assert(count == 0);

        AnimationHandler.Default.Update(0.5f);
        AnimationHandler.Default.Update(0.5f);

        Assert(!AnimationManager.Default.Streams.Active(Streams.STREAM_0));
        Assert(count == 1);

        LayoutManagerTests.Reset(this);
    }