示例#1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(TileSet.Color);


            Arena.Draw(SpriteBatch);
            KeyboardInput.Draw(SpriteBatch);
            SpriteBatch.End();
            SpriteBatch.Begin();
            SpriteBatch.Draw(Pixel, Vector2.Zero, new Rectangle(0, 0, (int)Width, (int)Height), Color.White * _fader.Fade);
            SpriteBatch.Draw(Textures.Mouse, UnifiedInput.Location, Color.White);
            SpriteBatch.End();
            base.Draw(gameTime);
        }
示例#2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            SideBar.Update();
            //  Clouds.Update(gameTime);
            TouchInput.Update(gameTime);
            MouseInput.Update(gameTime);
            UnifiedInput.Update(gameTime);
            KeyboardInput.Update(gameTime);

            UpdateFaders(gameTime);
            MenuMap.Update(gameTime);
            Arena.Update(gameTime);
            Sprites.Update(gameTime);
            Sounds.Update();
            base.Update(gameTime);
        }
示例#3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            SpriteBatch = new SpriteBatch(GraphicsDevice);
            Pixel       = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            Pixel.SetData(new[] { Color.White });
            Logo    = new TitleLogo(this);
            SideBar = new SideBar(this);

            MouseInput    = new MouseInput();
            TouchInput    = new TouchInput();
            UnifiedInput  = new UnifiedInput(this);
            KeyboardInput = new KeyboardInput(this);
            UnifiedInput.TapListeners.Add(t => Arena?.OnTap(t));

            Textures.LoadContent(Content);
            Sprites.LoadContent(this, Content);
            Fonts.LoadContent(Content);
            Sounds = new Sounds(this);

            TileSet01 = new TileSet(Strings.Park, new Color(37f / 255f, 92f / 255f, 64f / 255f), Textures.TileSetJungle01, Textures.TileSetShadows, Textures.TileSetBridges);
            TileSet02 = new TileSet(Strings.Jungle, new Color(13f / 255f, 69f / 255f, 17f / 255f), Textures.TileSetJungle02, Textures.TileSetShadows, Textures.TileSetBridges);
            TileSet03 = new TileSet(Strings.RoadBlock, new Color(101f / 255f, 97f / 255f, 96f / 255f), Textures.TileSetRoad01, Textures.TileSetShadows, Textures.TileSetBridgesRoad);
            TileSet04 = new TileSet(Strings.Geiger, new Color(39f / 255f, 37f / 255f, 92f / 255f), Textures.TileSetGeiger01, Textures.TileSetShadows, Textures.TileSetBridgesGeiger);


            TileSets = new TileSet[] { TileSet01, TileSet02, TileSet03, TileSet04 };
            TileSet  = TileSets[GameSettings.TileSet];

            MenuMap.Initialize();

            MenuArena  = new MenuArena(this);
            PauseArena = new PauseArena(this, MenuArena);

            _arena = MenuArena;
            _arena.Initialise();
        }