public InputManager(Game1 game, Player player, Level level, Target target, PlayerManager playerManager, Screen[] screens, MindRead mindRead) { this.game = game; this.player = player; this.level = level; this.target = target; this.playerManager = playerManager; this.mindRead = mindRead; this.collisionManager = new CollisionManager(player, level); this.velocity = player.getVelocity(); this.width = game.getWidth(); this.height = game.getHeight() - 40; this.font = game.getDropFont(); this.gameState = GameState.Normal; this.prevLevel = level; }
/// <summary> /// Returns whether or not the game object is currently on the screen /// </summary> /// <param name="game">The game instance to check its viewport bounds</param> /// <returns>Returns true if the game object is currently on the screen; otherwise, false</returns> public bool isOnScreen(Game1 game) { return location.X >= -texture.Width && location.X <= game.getWidth() && location.Y >= -texture.Height && location.Y <= game.getHeight() - 40; }