private void SetSamplePiece() { editorParams.samplePiece = PieceController.GetPiece(compressedBuilding.pieceRow, indexBuilding); PictureBox picture = (PictureBox)GetUiControl("Picture"); picture.SetSpriteBack(editorParams.samplePiece.sprite); }
private static void AddTrees() { Dictionary <int, MapObjectProperties> treeList = new Dictionary <int, MapObjectProperties>(); //Todo add rotated trees and shadows etc probablyt for (int i = 0; i < 8; i++) { treeList.Add(i, new Tree(PieceController.GetPiece(12, i), null, null, Point.Zero, 3, 24)); } mapObjectTypeList.Add(MapObjectType.TREE, treeList); }
private void DrawPieceMap(SpriteBatch spriteBatch) { for (int x = 0; x < usingWidth; x++) { for (int y = 0; y < usingHeight; y++) { if (pieceMap[x, y] != -1) { Vector2 location = new Vector2(x * GroundLayerController.tileSize + GroundLayerController.halfTileSize, y * GroundLayerController.tileSize + GroundLayerController.halfTileSize); PieceController.GetPiece(pieceRow, pieceMap[x, y]).Draw(spriteBatch, location, sampleColor.ToColor(), 1f); } } } }
private static void AddToStreetLightList(Dictionary <int, MapObjectProperties> streetLightList, StreetLightType streetLightType, LightType lightType, Vector2 lightOffset, MapObjectShadowType shadowType, Point objectSize, Point shadowPointLeft, Point shadowPointTop, bool alwaysOn, int elevation) { int rowIndex = (int)streetLightType * 4; for (int i = 0; i < 4; i++) { Piece piece = PieceController.GetPiece(10, rowIndex + i); Light light = GraphicsManager.GetLight(lightType); Vector2 currentLightOffset = RotateVectorRight(lightOffset, GroundLayerController.tileSize, i); float radian = RotateRadiansRight(0, i); Point shadowPointOffset = GetShadowPoint(shadowPointLeft, shadowPointTop, GroundLayerController.tileSize, i, objectSize); Shadow shadowLeft = new Shadow(ShadowSpriteController.GetShadowSprite(shadowType, ShadowSide.LEFT, i), 0, 0, ShadowSide.LEFT, i, shadowPointOffset); Shadow shadowRight = new Shadow(ShadowSpriteController.GetShadowSprite(shadowType, ShadowSide.RIGHT, i), 0, 0, ShadowSide.RIGHT, i, shadowPointOffset); streetLightList.Add(rowIndex + i, new StreetLight(piece, light, currentLightOffset, radian, shadowLeft, shadowRight, shadowPointOffset, alwaysOn, elevation)); } }
public List <Building> GetBuildingList() { List <Building> buildingList = new List <Building>(); List <Color> availableColorList = new List <Color>(); foreach (ColorXML colorXML in availableColoursXMLList) { availableColorList.Add(colorXML.ToColor()); } int direction = baseDirectionFacing; for (int i = 0; i < 2; i++) { Piece[,] newPieceMap = new Piece[usingWidth, usingHeight]; for (int x = 0; x < usingWidth; x++) { for (int y = 0; y < usingHeight; y++) { int pieceId = pieceMap[x, y]; if (pieceId >= 0) { newPieceMap[x, y] = PieceController.GetPiece(pieceRow, pieceId); } } } List <Shadow> newShadowListLeft = new List <Shadow>(); List <Shadow> newShadowListRight = new List <Shadow>(); foreach (EditorShadow editingShadow in shadowList) { if (editingShadow.shadowSide == ShadowSide.LEFT) { int tileOffset = (ShadowSpriteController.GetShadowTileSize(MapObjectShadowType.BUILDING, ShadowSide.LEFT, editingShadow.shadowId).X) / GroundLayerController.tileSize; newShadowListLeft.Add(new Shadow(ShadowSpriteController.GetShadowSprite(MapObjectShadowType.BUILDING, editingShadow.shadowSide, editingShadow.shadowId), editingShadow.tileX, editingShadow.tileY, editingShadow.shadowSide, editingShadow.shadowId, new Point(editingShadow.shadowOffsetX, editingShadow.shadowOffsetY))); } else if (editingShadow.shadowSide == ShadowSide.RIGHT) { newShadowListRight.Add(new Shadow(ShadowSpriteController.GetShadowSprite(MapObjectShadowType.BUILDING, editingShadow.shadowSide, editingShadow.shadowId), editingShadow.tileX, editingShadow.tileY, editingShadow.shadowSide, editingShadow.shadowId, new Point(editingShadow.shadowOffsetX, editingShadow.shadowOffsetY))); } } buildingList.Add(new Building(newPieceMap, newShadowListLeft, newShadowListRight, direction, usingWidth, usingHeight, elevation, availableColorList, inTileShift)); if (i == 1) { break; } TranslatePieces180(); TranslateShadows180(); if (direction == 0) { direction = 4; } if (direction == 6) { direction = 2; } } return(buildingList); }
// coord + refCoord => (0,0) + (1,1) public Piece GetRefPiece(Vector2 refCoord) { return(pieceController.GetPiece(coord + refCoord)); }