Ejemplo n.º 1
0
        public static LevelScreen BuildLevelScreen(Game game, Func<Level> createLevel)
        {
            var screen = new LevelScreen();
            var gameState = game.Services.GetService<GameState>();

            gameState.Player = new Player
            {
                WorldPosition = new Vector2(0, 0),
                AttackDamage = 60f,
                AttackRange = 1280
            };

            gameState.Camera.Position = Vector2.Zero;
            gameState.Camera.FocusedAt = gameState.Player;
            gameState.AreControlsEnabled = true;
            gameState.IsGameOver = false;

            gameState.Level = createLevel();

            var medcitMetadata = game.Content.Load<MedcitMetadata>(gameState.Inventory.Medcit);
            medcitMetadata.AssetName = @"Textures/Inventory/medkit1";

            gameState.Inventory.AddReuseble(Items.SmallShield);
            gameState.Inventory.AddReuseble(Medcit.FromMetadata(medcitMetadata, game.Content));
            if (!String.IsNullOrEmpty(gameState.Inventory.Tablet))
            {
                gameState.Inventory.AddReuseble(
                    Tablet.FromMetadata(game.Content.Load<TabletMetadata>(gameState.Inventory.Tablet), game.Content));
            }
            if (!String.IsNullOrEmpty(gameState.Inventory.Spike))
            {
                gameState.Inventory.AddReuseble(Items.Spike);
            }

            gameState.Player.Nanobot.EmitParticle = x => EmitParticle(x, screen.Level);

            return screen;
        }
Ejemplo n.º 2
0
 public WindowsInputHandler(Game game, LevelScreen host)
     : base(game)
 {
     _host = host;
     _game = game;
 }