public virtual void init(TilePerspective perspective)
 {
     foreach (KeyValuePair<int, TilePerspectiveAdjuster> adjuster in adjusters)
     {
         adjuster.Value.init(perspective);
     }
 }
Exemple #2
0
 public virtual void draw(int coordNS, int coordWE, TilePart tilePart, TilePerspective perspective, SpriteBatch spriteBatch)
 {
     foreach (TileSection tile in tileSections)
     {
         tile.draw(coordNS, coordWE, tilePart, perspective, spriteBatch);
     }
 }
Exemple #3
0
 public virtual void draw(int coordNS, int coordWE, TilePart tilePart, TilePerspective perspective, SpriteBatch spriteBatch)
 {
     float[] heights = drawablePack.getHeightRange(tilePart, minHeight, maxHeight);
     TileDrawInfo tdi;
     foreach (float height in heights)
     {
         tdi = perspective.getTileDrawInfo(coordNS, coordWE, height, tilePart, slopeInfo);
         drawablePack.draw(tdi, spriteBatch);
     }
 }
Exemple #4
0
 public TileMap(TilePerspective perspective)
 {
     this.perspective = perspective;
     tiles = new Tile[perspective.tilesNS, perspective.tilesWE];
     for (int ns = 0; ns < perspective.tilesNS; ns++)
     {
         for (int we = 0; we < perspective.tilesWE; we++)
         {
             tiles[ns, we] = new Tile();
         }
     }
 }
Exemple #5
0
        /*
         */
        public override void loadContent()
        {
            initAssets();

            (baseLeft as SimpleTileTexture).leftFace = dbls["faceLeft1"];
            (baseLeft as SimpleTileTexture).tileHeight = 1;
            (baseRight as SimpleTileTexture).rightFace = dbls["faceRight1"];
            (baseRight as SimpleTileTexture).tileHeight = 1;
            (baseSurface as SimpleTileTexture).surface = dbls["grass1"];

            TextureTileDrawablePack texPack = basePack as TextureTileDrawablePack;
            texPack.textures.Add(TilePart.LEFTFACE, baseLeft);
            texPack.textures.Add(TilePart.RIGHTFACE, baseRight);
            texPack.textures.Add(TilePart.SURFACE, baseSurface);

            TilePerspective persp = new TilePerspective(128, 4, 3);
            persp.addAdjuster(new TileFaceAdjuster(0.1f));
            persp.initAdjusters();

            tileMap = new TileMap(persp);
            persp.position.X += 200;
            persp.position.Y += 200;
            //tileMap.drawLeftface = false;
            //tileMap.drawRightface = false;
            for (int ns = 0; ns < tileMap.getTilesNS(); ns++)
            {
                for (int we = 0; we < tileMap.getTilesWE(); we++)
                {
                    tileMap[ns, we].addTileSection(0, 0, basePack.clone());
                }
            }

            tileMap[0, 0].getTileSection(0).maxHeight = 2;
            tileMap[2, 1].getTileSection(0).maxHeight = 1;

            //for (int ns = 0; ns < tileMap.getTilesNS(); ns++)
            //{
            //    for (int we = 0; we < tileMap.getTilesWE(); we++)
            //    {
            //        if (ns == 0 && we == 0) continue;

            //        texPack = tileMap[ns, we].getTileSection(0).drawablePack as TextureTileDrawablePack;
            //        texPack.textures.Remove(TilePart.LEFTFACE);
            //        texPack.textures.Remove(TilePart.RIGHTFACE);
            //        (texPack.textures[TilePart.SURFACE] as SimpleTileTexture).surface.color = Color.Red;
            //    }
            //}
        }
 public virtual void init(TilePerspective perspective)
 {
     this.perspective = perspective;
 }