示例#1
1
 public virtual void draw(TileDrawInfo drawInfo, SpriteBatch spriteBatch)
 {
     switch (drawInfo.tilePart)
     {
         case TilePart.STRUCTURE:
             foreach (Drawable structure in structures)
             {
                 adjustedDepthDraw(structure, drawInfo, spriteBatch);
             }
             break;
         case TilePart.SURFACE:
             if (surface == null)
             {
                 break;
             }
             adjustedDepthDraw(surface, drawInfo, spriteBatch);
             break;
         case TilePart.LEFTFACE:
             if (leftFace == null)
             {
                 break;
             }
             adjustedDepthDraw(leftFace, drawInfo, spriteBatch);
             break;
         case TilePart.RIGHTFACE:
             if (rightFace == null)
             {
                 break;
             }
             adjustedDepthDraw(rightFace, drawInfo, spriteBatch);
             break;
     }
 }
 public virtual void adjust(TileDrawInfo tileDrawInfo)
 {
     if (adjusters.ContainsKey(tileDrawInfo.slopeInfo.getSlopeTypeId()))
     {
         adjusters[tileDrawInfo.slopeInfo.getSlopeTypeId()].adjust(tileDrawInfo);
     }
 }
示例#3
0
 public virtual void adjust(TileDrawInfo drawInfo)
 {
     float newHeight = drawInfo.slopeInfo.getRelativeHeight(0, 0);
     Vector2 newPos = perspective.getTilePixelPosition(drawInfo.coordNS, drawInfo.coordWE, newHeight, drawInfo.tilePart);
     drawInfo.pos = newPos;
     drawInfo.adjustedHeight = newHeight;
 }
 public override void drawSurface(TileDrawInfo drawInfo, SpriteBatch spriteBatch)
 {
     if (!textures.ContainsKey(TilePart.SURFACE)) {
         return;
     }
     textures[TilePart.SURFACE].draw(drawInfo, spriteBatch);
 }
 public override void drawStructure(TileDrawInfo drawInfo, SpriteBatch spriteBatch)
 {
     if (!textures.ContainsKey(TilePart.STRUCTURE)) {
         return;
     }
     textures[TilePart.STRUCTURE].draw(drawInfo, spriteBatch);
 }
示例#6
0
 public virtual void adjust(TileDrawInfo drawInfo)
 {
     if (drawInfo.tilePart == TilePart.LEFTFACE)
     {
         float pxShiftX = leftShift * perspective.tilePixelWidth;
         drawInfo.pos.X += pxShiftX;
     }
     else if (drawInfo.tilePart == TilePart.RIGHTFACE)
     {
         float pxShiftX = rightShift * perspective.tilePixelWidth;
         drawInfo.pos.X += pxShiftX;
     }
 }
示例#7
0
 public virtual void draw(TileDrawInfo drawInfo, SpriteBatch spriteBatch)
 {
     switch (drawInfo.tilePart)
     {
         case TilePart.STRUCTURE:
             drawStructure(drawInfo, spriteBatch);
             break;
         case TilePart.SURFACE:
             drawSurface(drawInfo, spriteBatch);
             break;
         case TilePart.LEFTFACE:
             drawLeftFace(drawInfo, spriteBatch);
             break;
         case TilePart.RIGHTFACE:
             drawRightFace(drawInfo, spriteBatch);
             break;
     }
 }
示例#8
0
 protected virtual void adjustedDepthDraw(Drawable dbl, TileDrawInfo tdi, SpriteBatch sb)
 {
     float origDepth = dbl.depth;
     dbl.depth = tdi.getAdjustedDepth(origDepth);
     dbl.draw(sb, tdi.pos, tdi.scale, Color.White, 0);
     dbl.depth = origDepth;
 }
示例#9
0
 public abstract void drawSurface(TileDrawInfo drawInfo, SpriteBatch spriteBatch);
示例#10
0
 public abstract void drawStructure(TileDrawInfo drawInfo, SpriteBatch spriteBatch);
示例#11
0
 public abstract void drawRightFace(TileDrawInfo drawInfo, SpriteBatch spriteBatch);
示例#12
0
        public virtual TileDrawInfo getTileDrawInfo(int coordNS, int coordWE, float height, TilePart part, TileSlopeInfo slopeInfo)
        {
            Direction facing = getDirectionFacing();
            Vector2 pxPos = getTilePixelPosition(coordNS, coordWE, height, part);
            Vector2 scale = getScale();
            float depth = getTileDepth(depthShift, coordNS, coordWE, part);
            int digitCount = getDepthDigitsNeeded(depthShift);
            TileDrawInfo tdi = new TileDrawInfo(coordNS, coordWE, height, height, facing, part, slopeInfo, pxPos, scale, depth, digitCount);

            adjusters.adjust(tdi);

            return tdi;
        }