protected void constructLevel() { DebugPlatform plateform = new DebugPlatform(MainGame, 0, 1000, 10000, 20, Color.SandyBrown); AddToScene(plateform); plateform = new DebugPlatform(MainGame, 0, 0, 20, 1000, Color.SandyBrown); AddToScene(plateform); AddToScene(new DebugPlatform(MainGame, 100, 900, 2, 2, Color.White)); //plateform = new DebugPlatform(MainGame, 500, 800, 20, 136, Color.SandyBrown); //AddToScene(plateform); AddToScene(new Lever(MainGame, new Point(250, 904), TimeSpan.FromMilliseconds(100))); AddToScene(new Lever(MainGame, new Point(300, 968), TimeSpan.FromMilliseconds(100))); AddToScene(new PassthroughPlatform(MainGame, 400, 750, 200)); int i = 0; for (; i < 5; i++) { plateform = new DebugPlatform(MainGame, (600 + (i * (63 + 20))), 800, 20, 20, Color.Magenta); AddToScene(plateform); } for (; i < 10; i++) { plateform = new DebugPlatform(MainGame, 600 + (i * (64 + 20)), 800, 20, 20, Color.Green); AddToScene(plateform); } plateform = new DebugPlatform(MainGame, 1500, 0, 20, 936, Color.SandyBrown); AddToScene(plateform); Door door = new Door(MainGame, new Point(1500, 873)); AddToScene(door); Lever lever = new Lever(MainGame, new Point(1350, 768), TimeSpan.FromSeconds(2)); lever.SwitchedOn += door.Open; lever.SwitchedOff += door.Close; AddToScene(lever); }
public Scene2(MainGame mainGame) : base(mainGame) { mainGame.IsMouseVisible = true; debugPlatforms = new DebugPlatform[2]; debugPlatforms[0] = new DebugPlatform(mainGame, 50, 50, 100, 100, Color.DarkGreen); debugPlatforms[1] = new DebugPlatform(mainGame, 200, 200, 100, 100, Color.DarkRed); AddToScene(debugPlatforms[0]); AddToScene(debugPlatforms[1]); debugPlatformIndex = 0; MinkowskiDifference = new DebugPlatform(mainGame, 0, 0, 0, 0, Color.Red); AddToScene(MinkowskiDifference); AddToScene(new DebugPlatform(mainGame, 0, 0, 1, 1, Color.Black)); Camera.Center = mainGame.GraphicsDevice.Viewport.Bounds.Center; }
public override void Update(GameTime gameTime) { MouseState mouseState = Mouse.GetState(); if (mouseState.LeftButton == ButtonState.Pressed) { DebugPlatform debugPlatform = debugPlatforms[debugPlatformIndex]; if (lastMouseState.LeftButton == ButtonState.Pressed) { debugPlatform.Size = Camera.ToWorld(mouseState.Position.ToVector2()) - debugPlatform.Location; } else { debugPlatform.Location = Camera.ToWorld(mouseState.Position.ToVector2()); } } else if (lastMouseState.LeftButton == ButtonState.Pressed) { debugPlatformIndex = (debugPlatformIndex + 1) % debugPlatforms.Length; } lastMouseState = mouseState; base.Update(gameTime); }