public void Draw( EditableCube.Face face, SpriteBatch spriteBatch, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            return;
        }
        public void End( EditableCube.Face face, Vector2? mousePos, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            Cancel();
        }
示例#3
0
 /// <summary>
 /// Creates a new EditScreen.
 /// </summary>
 /// <param name="game">Game the EditScreen should be associated with.</param>
 /// <param name="editCube">EditableCube the screen should display.</param>
 public EditScreen( CubeGame game, EditableCube editCube )
     : base(game, editCube)
 {
     ScreenProperties = new EditScreenProperties( this );
     LeftBrush = new BoxBrush( game );
     RightBrush = new HandBrush( game );
     MiddleBrush = new StartPositionBrush( game );
 }
        public void Draw( EditableCube.Face face, SpriteBatch spriteBatch, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            Color color = ValidLine
                          ? new Color( 0, 0, 0, 255 )
                          : new Color( 0, 0, 0, 128 );

            spriteBatch.DrawLine( mLine, mTexture, color, 10 );
        }
示例#5
0
        public void Draw( EditableCube.Face face, SpriteBatch spriteBatch, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            Color color = ValidRec
                          ? new Color( 0, 0, 0, 255 )
                          : new Color( 0, 0, 0, 128 );

            spriteBatch.Draw( mTexture, (Rectangle) mRec, color );
        }
        public void End( EditableCube.Face face, Vector2? mousePos, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            if ( mousePos != null )
            {
                Vector2 pos = EditScreen.SnapVector( mousePos.Value, EditScreen.SNAP_SIZE / 2 );
                face.Cube.StartPosition.Position = face.ConvertFaceToCube( pos );
                face.Cube.StartPosition.Rotation = face.Cube.UpDir.Angle;
            }

            Cancel();
        }
 public void Start( EditableCube.Face face, Vector2 mousePos, GameTime gameTime )
 {
     Solid solid = face.FindSolidAt( mousePos.ToUnits() );
     if ( solid != null )
     {
         switch ( solid.BodyType )
         {
         case BodyType.Static:
             solid.BodyType = BodyType.Dynamic;
             solid.Body.CollisionCategories = Category.Cat2;
             break;
         case BodyType.Dynamic:
             solid.BodyType = BodyType.Static;
             solid.Body.CollisionCategories = Category.Cat1;
             break;
         }
     }
 }
        public void Draw( EditableCube.Face face, SpriteBatch spriteBatch, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            spriteBatch.Draw(
                mTexture,
                mCurrentPos,
                null,
                Color.Black,
                0,//Body.Rotation,
                new Vector2(
                    mTexture.Width,
                    mTexture.Height ) / 2,
                Vector2.One,
                SpriteEffects.None,
                0 );
        }
        public void Draw( EditableCube.Face face, SpriteBatch spriteBatch, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            spriteBatch.Draw(
                mTexture,
                mCurrentPos,
                null,
                Color.White,
                face.Cube.UpDir.Angle,
                new Vector2(
                    mTexture.Width,
                    mTexture.Height ) / 2,
                new Vector2( EndDoor.WIDTH, EndDoor.HEIGHT ),
                SpriteEffects.None,
                0 );
        }
示例#10
0
        public void End( EditableCube.Face face, Vector2? mousePos, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            if ( ValidLine )
            {
                OneWayPlatform platform = new OneWayPlatform(
                    face.Game,
                    face.World,
                    mLine );

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

                face.AddSolid( platform );
            }

            Cancel();
        }
示例#11
0
        public void End( EditableCube.Face face, Vector2? mousePos, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            if ( mousePos != null )
            {
                EndDoor door = new EndDoor(
                    face.Game,
                    face.World,
                    mousePos.Value,
                    mNextLevel );

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

                face.AddSolid( door );
            }

            Cancel();
        }
示例#12
0
        public void End( EditableCube.Face face, Vector2? mousePos, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            if ( ValidRec )
            {
                HazardBox box = new HazardBox(
                    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();
        }
示例#13
0
        public void Draw( EditableCube.Face face, SpriteBatch spriteBatch, GameTime gameTime )
        {
            if ( face != mFace )
                return;

            #if WINDOWS
            if ( mSelectedSolid != null )
            {
                face.DebugView.BeginCustomDraw( Cube.Face.DEBUG_PROJECTION, Matrix.Identity );

                double t = (gameTime.TotalGameTime.TotalSeconds % 4 / 2) - 1;
                byte val = (byte) (150 + Math.Abs( t * 105 ));
                Color color = new Color( val, val, val, 255 );

                Body b = mSelectedSolid.Body;
                Transform trans;
                b.GetTransform( out trans );
                foreach ( Fixture f in b.FixtureList )
                    face.DebugView.DrawShape( f, trans, color );

                face.DebugView.EndCustomDraw();
            }
            #endif
        }
        public void End( EditableCube.Face face, Vector2? mousePos, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            if ( mousePos != null )
            {
                Quarterpipe qpipe = new Quarterpipe(
                    face.Game,
                    face.World,
                    mSmall ? 50 : 100,
                    mousePos.Value,
                    Quarterpipe.Type.SE );

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

                face.AddSolid( qpipe );
            }

            Cancel();
        }
示例#15
0
 public void Update( EditableCube.Face face, Vector2 mousePos, GameTime gameTime )
 {
     if ( !Started || face != mFace )
         return;
 }
示例#16
0
 public Face( EditableCube cube, CubeFaceType type, Vector3 normal, Vector3 up, Direction orientation )
     : base(cube, type, normal, up, orientation)
 {
 }
示例#17
0
        public void End( EditableCube.Face face, Vector2? mousePos, GameTime gameTime )
        {
            if ( face != mFace )
                return;

            if ( !Started )
            {
                Cancel();
            }
            else
            {
                Started = false;
                mStartPos = Vector2.Zero;
            }
        }
示例#18
0
        public void Update( EditableCube.Face face, Vector2 mousePos, GameTime gameTime )
        {
            if ( face != mFace )
                return;

            var input = Game.Input;

            if ( input.CheckFocus( mSelectedSolid ) )
            {
                Vector2 delta = Vector2.Zero;

                if ( input.Keyboard.IsKeyDown( Keys.Up ) )
                    delta.Y += -1.ToUnits();

                if ( input.Keyboard.IsKeyDown( Keys.Right ) )
                    delta.X += 1.ToUnits();

                if ( input.Keyboard.IsKeyDown( Keys.Down ) )
                    delta.Y += 1.ToUnits();

                if ( input.Keyboard.IsKeyDown( Keys.Left ) )
                    delta.X += -1.ToUnits();

                if ( input.GetAction( Action.RotateClockwise ) )
                    mSelectedSolid.Rotation += MathHelper.PiOver2;

                if ( input.GetAction( Action.RotateAntiClockwise ) )
                    mSelectedSolid.Rotation -= MathHelper.PiOver2;

                mSelectedSolid.Position += delta.Rotate( face.Cube.UpDir.Angle );

                if ( input.Keyboard_WasAnyKeyPressed( Keys.Delete, Keys.Back ) )
                {
                    face.RemoveSolid( mSelectedSolid );
                    Cancel();
                }
            }

            if ( !Started )
                return;

            mSelectedSolid.Position = mOriginalPos + (mousePos.ToUnits() - mStartPos.ToUnits());

            if ( !input.IsShiftDown() )
            {
                mSelectedSolid.Position = EditScreen.SnapVector( mSelectedSolid.Position.ToPixels(), EditScreen.SNAP_SIZE / 2 ).ToUnits();
            }
            else
            {
                mSelectedSolid.Position = mSelectedSolid.Position
                                                        .ToPixels()
                                                        .Rounded()
                                                        .ToUnits();
            }
        }
示例#19
0
        public void Start( EditableCube.Face face, Vector2 mousePos, GameTime gameTime )
        {
            Solid selectedSolid = face.FindSolidAt( mousePos.ToUnits() );

            if ( selectedSolid != mSelectedSolid )
                Cancel();

            if ( selectedSolid != null )
            {
                mFace = face;
                Started = true;
                mStartPos = mousePos;
                mSelectedSolid = selectedSolid;
                mOriginalPos = mSelectedSolid.Position;
                Game.Input.Focus = mSelectedSolid;
            }
        }
        public void Start( EditableCube.Face face, Vector2 mousePos, GameTime gameTime )
        {
            mTexture = new Texture2D( Game.GraphicsDevice, 1, 1 );
            mTexture.SetData( new[] { Color.White } );

            mFace = face;
            Started = true;
            mStartPos = mousePos;
        }
        public void Start( EditableCube.Face face, Vector2 mousePos, GameTime gameTime )
        {
            mTexture = Quarterpipe.CreateQuarterpipeTexture(
                Game.GraphicsDevice,
                mSmall ? 50 : 100,
                new Color( 255, 255, 255, 128 ) );

            mFace = face;
            Started = true;
            mStartPos = mousePos;
        }
示例#22
0
        public void Update( EditableCube.Face face, Vector2 mousePos, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            mLine.P1 = EditScreen.SnapVector( mousePos );

            if ( !ValidLine )
                mLine.P1 = mousePos;
        }
示例#23
0
        public void Start( EditableCube.Face face, Vector2 mousePos, GameTime gameTime )
        {
            mTexture = new Texture2D( Game.GraphicsDevice, 1, 1 );
            mTexture.SetData( new[] { Color.White } );

            mFace = face;
            Started = true;
            mLine.P0 = EditScreen.SnapVector( mousePos );
        }
        public void Update( EditableCube.Face face, Vector2 mousePos, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            mCurrentPos = EditScreen.SnapVector( mousePos, EditScreen.SNAP_SIZE / 2 );
        }
示例#25
0
        public void Update( EditableCube.Face face, Vector2 mousePos, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            mousePos = EditScreen.SnapVector( mousePos );

            mRec.X = Math.Min( mStartPos.X, mousePos.X );
            mRec.Y = Math.Min( mStartPos.Y, mousePos.Y );

            mRec.Width = Math.Abs( mStartPos.X - mousePos.X );
            mRec.Height = Math.Abs( mStartPos.Y - mousePos.Y );
        }