public InputManager(Game1 game, Entity player, Level level, List<Screen> screens) { this.game = game; this.player = player; this.selectedObject = null; this.level = level; collisionManager = new CollisionManager(player, level); screenManager = new ScreenManager(screens[1], screens); stepSize = game.getStepSize(); midX = game.getMidX(); midY = game.getMidY(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { base.LoadContent(); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); playerTexture = Content.Load<Texture2D>("player"); midX = (graphics.PreferredBackBufferWidth - playerTexture.Width) / 2; midY = (graphics.PreferredBackBufferHeight - playerTexture.Height) / 2; player = new Entity(playerTexture, new Projectile(Content.Load<Texture2D>("bullet"), new Vector2(midX, midY), 7, 250, 0.5f), new Vector2(midX, midY), Direction.EAST, GraphicsDevice.Viewport.Bounds, 50, 5); npc = new Entity(Content.Load<Texture2D>("npc"), null, new Vector2(midX + 148, midY + 148), Direction.EAST, GraphicsDevice.Viewport.Bounds, 50, 5); obj = new GameObject(Content.Load<Texture2D>("sprite"), null, new Vector2(midX + 100, midY + 100), GraphicsDevice.Viewport.Bounds, true); level = new Level(player, Content.Load<Texture2D>("map"), new Entity[] { npc }, new GameObject[] { obj }); // Initialize list of game screens, and add screens. Menu should be the first screen active. screens = new List<Screen>(); screens.Add(new Screen("Menu", false)); screens.Add(new Screen("Normal", true)); screens.Add(new Screen("Telekinesis-Select", false)); screens.Add(new Screen("Telekinesis-Move", false)); inputManager = new InputManager(this, player, level, screens); cursor = Content.Load<Texture2D>("cursor"); // TODO: use this.Content to load your game content here }
public CollisionManager(Entity player, Level level) { this.player = player; this.level = level; }