コード例 #1
0
            private void SetUpWorld()
            {
                mWorld = new World( Vector2.Zero );
                return;

                var box = new Box(
                        Game,
                        World,
                        new Rectangle( 360, 0, 100, 100 ),
                        BodyType.Dynamic, 30, Category.Cat3 );

                box.Body.UseAdHocGravity = true;
                box.Body.AdHocGravity = new Vector2( 0, 9.8f );

                AddSolid( box );

                AddSolid(
                    new Quarterpipe(
                        Game,
                        World,
                        100,
                        new Vector2( 850, 850 ),
                        Quarterpipe.Type.SE ) );

                AddSolid(
                    new Corner(
                        Game,
                        World,
                        100,
                        new Vector2( 450, 750 ),
                        Corner.Type.NE ) );

                AddSolid(
                    new Box(
                        Game,
                        World,
                        new Rectangle( 900, 600, 100, 400 ) ) );

                AddSolid(
                    new Box(
                        Game,
                        World,
                        new Rectangle( 0, HEIGHT - 100, WIDTH, 100 ) ) );

                AddSolid(
                    new Box(
                        Game,
                        World,
                        new Rectangle( 100, 700, 300, 100 ) ) );

                AddSolid(
                    new Box(
                        Game,
                        World,
                        new Rectangle( WIDTH - 150, 150, 100, 300 ) ) );

                AddSolid( new OneWayPlatform( Game, World, new Line2( 400, 200, 100, 200 ) ) );
                AddSolid( new OneWayPlatform( Game, World, new Line2( 100, 400, 400, 400 ) ) );
                AddSolid( new OneWayPlatform( Game, World, new Line2( 700, 500, 700, 200 ) ) );
                //AddSolid( new OneWayPlatform( Game, World, new Line2( 400, 200, 550, 300 ) ) );
                //AddSolid( new OneWayPlatform( Game, World, new Line2( 380, 910, 380, 790 ) ) );
                //AddSolid( new OneWayPlatform( Game, World, new Line2( 240, 910, 240, 790 ) ) );
                //AddSolid( new OneWayPlatform( Game, World, new Line2( 100, 910, 100, 790 ) ) );
            }
コード例 #2
0
        public void End( EditableCube.Face face, Vector2? mousePos, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            if ( ValidRec )
            {
                Box box = new Box(
                    face.Game,
                    face.World,
                    mRec,
                    BodyType.Static );

                box.Body.UseAdHocGravity = true;
                box.Body.AdHocGravity =
                    Vector2.UnitY.Rotate( face.Cube.UpDir.Angle ).Rounded()
                    * 9.8f;

                face.AddSolid( box );
            }

            Cancel();
        }