示例#1
0
        private void DrawTilesBlocks(GameTime gametime, SpriteBatch spriteBatch)
        {
            Texture2D texture = null;
            //Rectangle rectangleMask = new Rectangle();

            Vector2 position = new Vector2(0, 0);

            // For each Tile position
            for (int y = Height - 1; y >= 0; --y)
            {
                for (int x = 0; x < Width; ++x)
                {
                    if (tiles[x, y].Type == Enumeration.TileType.block)
                    {
                        if (x > 0 && (tiles[x - 1, y].Type == Enumeration.TileType.space | tiles[x - 1, y].Type == Enumeration.TileType.floor))
                        {
                            position = new Vector2(tiles[x, y].Position.X, tiles[x, y].Position.Y);
                            texture  = (Texture2D)Maze.Content[PoP.CONFIG_TILES + "Block_left"];
                            //texture = Maze.Content.Load<Texture2D>(PrinceOfPersiaGame.CONFIG_TILES + "Block_left");
                            tiles[x, y].tileAnimation.DrawTile(gametime, spriteBatch, position, SpriteEffects.None, 0.1f, texture);

                            //divider
                            position = new Vector2(tiles[x, y].Position.X + 16, tiles[x, y].Position.Y + 64);
                            texture  = (Texture2D)Maze.Content[PoP.CONFIG_TILES + "Block_divider2"];
                            //texture = Maze.content.Load<Texture2D>(PrinceOfPersiaGame.CONFIG_TILES + "Block_divider2");
                            tiles[x, y].tileAnimation.DrawTile(gametime, spriteBatch, position, SpriteEffects.None, 0.1f, texture);
                        }

                        if (tiles[x, y].nextTileType == Enumeration.TileType.block)
                        {
                            for (int s = 0; s < Block.seed_graystone.GetLength(1); s++)
                            {
                                if (Block.seed_graystone[0, s] == tiles[x, y].panelInfo)
                                {
                                    position = new Vector2(tiles[x, y].Position.X, tiles[x, y].Position.Y + 21);
                                    texture  = (Texture2D)Maze.Content[PoP.CONFIG_TILES + "Block_random"];
                                    //texture = Maze.content.Load<Texture2D>(PrinceOfPersiaGame.CONFIG_TILES + "Block_random");
                                    tiles[x, y].tileAnimation.DrawTile(gametime, spriteBatch, position, SpriteEffects.None, 0.1f, texture);
                                }
                                if (Block.seed_left_top[2, s] == ((Block)tiles[x, y]).panelInfo)
                                {
                                    position = new Vector2(tiles[x, y].Position.X, tiles[x, y].Position.Y);
                                    texture  = (Texture2D)Maze.Content[PoP.CONFIG_TILES + "Block_left"];
                                    //texture = Maze.content.Load<Texture2D>(PrinceOfPersiaGame.CONFIG_TILES + "Block_left");
                                    tiles[x, y].tileAnimation.DrawTile(gametime, spriteBatch, position, SpriteEffects.None, 0.1f, texture);

                                    //divider
                                    position = new Vector2(tiles[x, y].Position.X + 22, tiles[x, y].Position.Y + 64);
                                    texture  = (Texture2D)Maze.Content[PoP.CONFIG_TILES + "Block_divider"];
                                    //texture = Maze.content.Load<Texture2D>(PrinceOfPersiaGame.CONFIG_TILES + "Block_divider");
                                    tiles[x, y].tileAnimation.DrawTile(gametime, spriteBatch, position, SpriteEffects.None, 0.1f, texture);
                                }
                            }
                        }
                    }
                }
            }

            Up.DrawTilesUp(gametime, spriteBatch);
        }
示例#2
0
        private void DrawTilesMask(GameTime gametime, SpriteBatch spriteBatch)
        {
            Rectangle rectangleMask = new Rectangle();
            Vector2   position      = new Vector2(0, 0);

            // For each Tile position
            for (int y = Height - 1; y >= 0; --y)
            {
                for (int x = 0; x < Width; ++x)
                {
                    position = new Vector2(tiles[x, y].Position.X, tiles[x, y].Position.Y);



                    switch (tiles[x, y].Type)
                    {
                    case Enumeration.TileType.chomper:
                        //rectangleMask = Tile.MASK_CHOMPER;
                        //position.Y = position.Y + 128;
                        rectangleMask = new Rectangle(0, 0, 26, 148);
                        break;

                    case Enumeration.TileType.posts:
                        rectangleMask = Tile.MASK_POSTS;
                        break;

                    case Enumeration.TileType.gate:
                        position.X    = position.X + 50;
                        rectangleMask = Tile.MASK_DOOR;
                        break;

                    case Enumeration.TileType.block:
                        rectangleMask = Tile.MASK_BLOCK;
                        break;

                    case Enumeration.TileType.exit:
                        //position.Y -= 100;
                        //rectangleMask = Tile.MASK_FLOOR;
                        return;

                    default:
                        position.Y    = position.Y + 128;
                        rectangleMask = Tile.MASK_FLOOR;
                        break;
                    }

                    tiles[x, y].tileAnimation.DrawTileMask(gametime, spriteBatch, position, SpriteEffects.None, 0.1f, rectangleMask);

                    if (tiles[x, y].item != null)
                    {
                        position = new Vector2(tiles[x, y].Position.X, tiles[x, y].Position.Y);
                        tiles[x, y].item.itemAnimation.DrawItem(gametime, spriteBatch, position, SpriteEffects.None, 0.1f);
                    }
                }
            }

            Up.DrawTilesUp(gametime, spriteBatch);
        }