Exemplo n.º 1
0
        protected override void Open()
        {
            IShape shape = ShapeFactory.CreateColoredCircle(8, 15);

            DemoHelper.AddGrid(DemoInfo, shape, 40,
                               new BoundingRectangle(-500, 200, 800, 800),
                               50, 50);

            Viewport viewport2 = new Viewport(new Rectangle(Window.Size.Width / 2, 0, Window.Size.Width / 2, Window.Size.Height), Matrix2x3.Identity, Scene, new Lifespan());

            Window.AddViewport(viewport2);
            Viewport.Rectangle = new Rectangle(0, 0, Window.Size.Width / 2, Window.Size.Height);

            IShape furyShape = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("starfury.png"), 2, 16, 3);
            Body   b1        = DemoHelper.AddShape(DemoInfo, furyShape, 400, new ALVector2D(0, 0, 0));
            Body   b2        = DemoHelper.AddShape(DemoInfo, furyShape, 400, new ALVector2D(0, 0, 0));


            dispose += DemoHelper.RegisterBodyTracking(DemoInfo, b1, Matrix2x3.FromRotationZ(-MathHelper.PiOver2) * Matrix2x3.FromScale(new Vector2D(.5f, .5f)));
            dispose += DemoHelper.RegisterBodyMovement(DemoInfo, b1, new ALVector2D(1000000, 100000, 0), Key.W, Key.S, Key.A, Key.D);
            DoGuns(b1, b2, Key.Q);

            dispose += DemoHelper.RegisterBodyTracking(
                new DemoOpenInfo(Window, viewport2, Scene)
                , b2, Matrix2x3.FromRotationZ(-MathHelper.PiOver2) * Matrix2x3.FromScale(new Vector2D(.5f, .5f)));
            dispose += DemoHelper.RegisterBodyMovement(
                DemoInfo, b2, new ALVector2D(1000000, 100000, 0));
            DoGuns(b2, b1, Key.Return);

            b1.State.Position.Linear = new Vector2D(200, 0);
            b2.State.Position        = new ALVector2D(MathHelper.Pi, 1, 0);
            b1.ApplyPosition();
            b2.ApplyPosition();

            DemoHelper.AddShell(DemoInfo, new BoundingRectangle(-700, -700, 1000, 1000), 90, Scalar.PositiveInfinity);

            dispose += delegate()
            {
                viewport2.Lifetime.IsExpired = true;
                Viewport.Rectangle           = new Rectangle(0, 0, Window.Size.Width, Window.Size.Height);
            };

            DemoHelper.AddStarField(DemoInfo, 1000, new BoundingRectangle(-1000, -1000, 1300, 1300));
        }
Exemplo n.º 2
0
        protected override void Open()
        {
            IShape bombShape = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("rocket.png"), 2, 16, 3);

            dispose += DemoHelper.RegisterBombLaunching(DemoInfo, bombShape, 120);
            dispose += DemoHelper.RegisterMousePicking(DemoInfo);
            IShape shape = ShapeFactory.CreateColoredCircle(8, 15);

            DemoHelper.AddGrid(DemoInfo, shape, 40,
                               new BoundingRectangle(200, 200, 1100, 1100),
                               5, 5);



            Body b = DemoHelper.AddShape(DemoInfo, bombShape, 400, new ALVector2D(0, 0, 0));

            DemoHelper.RegisterBodyTracking(DemoInfo, b, Matrix2x3.FromRotationZ(-MathHelper.PiOver2));
            DemoHelper.RegisterBodyMovement(DemoInfo, b, new ALVector2D(50000, 50000, 0));
            DemoHelper.AddStarField(DemoInfo, 1000, new BoundingRectangle(-1000, -1000, 2300, 2300));
        }