Esempio n. 1
0
        public GameStateMars(ContentManager c, Game1 g)
        {
            Game = g;
            Content = c;

            rockMap = new RockMap(Content);

            windowRect = new Rectangle(0, 0, 1500, int.MaxValue);

            inputHandler = new InputHandler();

            drillSound = Content.Load<SoundEffect>("Drill");
            thrustSound = Content.Load<SoundEffect>("Thrust");
            drillSoundInstance = Content.Load<SoundEffect>("Drill").CreateInstance();
            drillSoundInstance.IsLooped = true;
            thrustSoundInstance = Content.Load<SoundEffect>("Thrust").CreateInstance();
            thrustSoundInstance.IsLooped = true;
            boomSound = Content.Load<SoundEffect>("Boom");

            sdSystem = new TextSystem("profont.png", Content);
            sdSystem.resetString(new Vector2(5, 725));
            sdSystem.addString("Out of energy. Press \\3ESC to self-destruct");

            bg = new Sprite("mars-bg.png", Content, new Vector2(0, 0), false);
            player = new Player("miner.png", Content, new Vector2(windowRect.Width/2, 25));
            shop = new Sprite("shop.png", Content, new Vector2(500, 25));
            deadOverlay = new Sprite("dead.png", Content, new Vector2(0, 0), false);

            otherPlayers = new Dictionary<string, Player>();

            mapOffset = new Vector2(0,-125);

            thrusters = false;
            transY = 0f;
            transX = 0f;

            drillTime = 0f;

            redTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            redTexture.SetData(new Color[] { Color.Red });
            blueTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            blueTexture.SetData(new Color[] { Color.Blue });
            greenTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            greenTexture.SetData(new Color[] { Color.Green });
            blackTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            blackTexture.SetData(new Color[] { Color.Black });
        }
 public void generateMoreMap(RockMap map)
 {
     Random ra = new Random();
     for (int x = 0; x < 30; x++)
     {
         string l = generateBufferMapLine(map.cols + x, ra);
         map.addRow(l);
     }
 }