private Rectangle3D getTextureExtents(StagePanel panel, Texture2D texture, int i, int j, int zOrder) { Rectangle3D panelExtents = panel.MyExtents; float xOffset = panelExtents.topLeft.X + (i * panel.MyCellSize); float yOffset = 0.0f; float zOffset = 0.0f; Vector3 bottomLeft; Vector3 bottomRight; if (panel.MyLocation == StageLocation.Background) { yOffset = panelExtents.topLeft.Y - (j * panel.MyCellSize); zOffset = 0.0f - zOrder; bottomLeft = new Vector3(xOffset, yOffset - texture.Height, zOffset); bottomRight = new Vector3(xOffset + texture.Width, yOffset - texture.Height, zOffset); } else { yOffset = 0.0f; zOffset = panelExtents.topRight.Z + (j * panel.MyCellSize); bottomLeft = new Vector3(xOffset, yOffset, zOffset + texture.Height); bottomRight = new Vector3(xOffset + texture.Width, yOffset, zOffset + texture.Height); } Vector3 topLeft = new Vector3(xOffset, yOffset, zOffset); Vector3 topRight = new Vector3(xOffset + texture.Width, yOffset, zOffset); return(new Rectangle3D(topLeft, topRight, bottomLeft, bottomRight)); }
public void addFloor(StageSection section, string textureName, int i, int j) { StagePanel panel = getPanel(section, StageLocation.Floor); Texture2D texture = lhg.Assets.loadTexture(textureName); Rectangle3D textureExtents = getTextureExtents(panel, texture, i, j, 0); SimpleSprite3D sprite = new SimpleSprite3D(lhg, texture, textureExtents); panel.addSprite(sprite); }
private void createSection(StageSection section) { switch (section) { case StageSection.Left: leftBackground = new StagePanel(lhg, section, StageLocation.Background, cellSize, leftWidth, backgroundHeight); leftFloor = new StagePanel(lhg, section, StageLocation.Floor, cellSize, leftWidth, floorHeight); break; case StageSection.Center: centerBackground = new StagePanel(lhg, section, StageLocation.Background, cellSize, centerWidth, backgroundHeight); centerFloor = new StagePanel(lhg, section, StageLocation.Floor, cellSize, centerWidth, floorHeight); break; case StageSection.Right: rightBackground = new StagePanel(lhg, section, StageLocation.Background, cellSize, centerWidth, backgroundHeight); rightFloor = new StagePanel(lhg, section, StageLocation.Floor, cellSize, centerWidth, floorHeight); break; } }