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); } }
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); }
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; } }
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; } }
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; }
public abstract void drawSurface(TileDrawInfo drawInfo, SpriteBatch spriteBatch);
public abstract void drawStructure(TileDrawInfo drawInfo, SpriteBatch spriteBatch);
public abstract void drawRightFace(TileDrawInfo drawInfo, SpriteBatch spriteBatch);
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; }