private void SetSampleShadow() { //Switch this to a box eventualy float x = 200 * DisplayController.uiScale; float y = 200 * DisplayController.uiScale; sampleShadow = new Shadow(ShadowSpriteController.GetShadowSprite(MapObjectShadowType.BUILDING, editorParams.shadowSide, indexShadow), 0, 0, editorParams.shadowSide, indexShadow, new Point((int)x, (int)y)); editorParams.hoverShadow = new Shadow(ShadowSpriteController.GetShadowSprite(MapObjectShadowType.BUILDING, editorParams.shadowSide, indexShadow), 0, 0, editorParams.shadowSide, indexShadow, new Point(0, 0)); }
private void DrawShadowMap(SpriteBatch spriteBatch) { if (editorParams.editingMode == EditingMode.Shadows) { foreach (EditorShadow editingShadow in shadowList) { if (editorParams.shadowSide == editingShadow.shadowSide) { Shadow shadow = new Shadow(ShadowSpriteController.GetShadowSprite(MapObjectShadowType.BUILDING, editingShadow.shadowSide, editingShadow.shadowId), editingShadow.tileX, editingShadow.tileY, editingShadow.shadowSide, editingShadow.shadowId, new Point(editingShadow.shadowOffsetX, editingShadow.shadowOffsetY)); shadow.DrawBuildingEditing(spriteBatch); } } } }
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)); } }
protected override void Initialize() { debugDrawTimeStopwatch = new Stopwatch(); // Window.IsBorderless = false; Data.SetSettings(); ScreenController.graphicsDevice = GraphicsDevice; DisplayController.Init(this); EngineController.Init(); GraphicsManager.Init(Content); AudioManager.Init(Content); //Game specific init. this could probably be done in game load GroundLayerController.Init(); AngleStuff.Init(); PieceController.Init(); ShadowSpriteController.Init(); MapObjectController.Init(); TileLogisticsController.Init(); GraphicsDevice.Clear(Color.White); IsMouseVisible = true; base.Initialize(); ScreenController.ChangeScreen(new MenuMain()); }
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); }